Answer the question
In order to leave comments, you need to log in
WPF. How to properly bind multiple ListView located in TabControl to one property?
The page has a TabControl with two tabs, each tab has one ListView. The ItemsSource properties of the ListView items are associated with a single ItemsSource specified in the page resources. When you first view the tabs, both ListViews are filled, i.e. the binding worked, but when re-viewing, only one ListView remains filled, the second one turns out to be empty. Help me to understand! Simplified, it looks like this:
------
<Page.Resources>
<ItemsSource x:Name="ISource" x:Key="ISource"/>
</Page.Resources>
--------
<TabControl>
<TabItem>
<ListView ItemsSource = "{Binding ItemsSource, ElementName ISource}" />
</TabItem>
<TabItem>
<ListView ItemsSource = "{Binding ItemsSource, ElementName ISource}" />
</TabItem>
</TabControl>
Answer the question
In order to leave comments, you need to log in
The Resources section declares the control's static resources. They need to be used like this:
x:Name is not needed in this case, only x:Key.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question