TabControl wipes out SelectedItem/SelectedIndex when recycled. #17102
-
I have an MDI application that uses a TabControl for all my documents. Some TabControl Tabs embedded other TabControls. When displaying a document tab that uses the same axaml and ViewModel type, the tab content is recycled as documented. My document ViewModels contain a property for the SelectedItem (I've also tested SelectedIndex). When the view is recycled the TabControl takes it on its' own to ignore the binding to the SelectedItem/SelectedIndex and sets it to the first item in the ObservableCollection found within the document ViewModel. The child TabControl should not be doing this. It should be honoring the Databinding rather that setting values on its' own. The TabControl SelectedItem/SelectedIndex binding appears to be totally busted. Does anyone have a work around for this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After reviewing the TabControl code I noticed the SelectionMode property. The following code worked around the issue for me:
|
Beta Was this translation helpful? Give feedback.
After reviewing the TabControl code I noticed the SelectionMode property. The following code worked around the issue for me: