Click to See Complete Forum and Search --> : [WPF] Binding


martin.developer
May 25th, 2009, 08:34 AM
Hello.

I have WPF aplication with two ListView a firt affects second using SelectionChanged="ListView_SelectionChanged" and I need in C# change ItemsSource for second ListView in ListView_SelectionChanged method.

Data is in <Window.Resources> and is it XmlDataProvider.

Can you help me please ?

gurge60
May 27th, 2009, 02:51 PM
Is the data provider hooked up to anything in XAML at all or is it just used in your code? If it is just used in your code, the data may not be loaded as you would expect. Try setting IsAsynchronous to False on your XmlDataProvider.

The actual assignment to the ItemsSource would probably look something like:

this.yourListView.ItemsSource = ((XmlDataProvider)this.Resources["yourXmlDataProviderKey"]).Data as IEnumerable;