KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Given the following code: <Window x:Class="WpfApplication76.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:col="clr-namespace:System.Collections;assembly=mscorlib" Title="Window1" Height="300" Width="300"> <Window.Resources> <CollectionViewSource x:Key="myCol"> <CollectionViewSource.Source> <col:ArrayList> <ListBoxItem>Uno</ListBoxItem> <ListBoxItem>Dos</ListBoxItem> <ListBoxItem>Tres</ListBoxItem> </col:ArrayList> </CollectionViewSource.Source> </CollectionViewSource> </Window.Resources> <Grid> <ListBox ItemsSource="{StaticResource myCol}" /> <ListBox ItemsSource="{Binding Source={StaticResource myCol}}" /> </Grid> </Window> In this example, the <ListBox ItemsSource="{StaticResource myCol}" /> Gives me an error complaining that it cannot bind to a "CollectionViewSource" object. But the other listbox: <ListBox ItemsSource="{Binding Source={StaticResource myCol}}" /> binds perfectly fine. So my question is why does one work and the other one does not? AT the end, aren't both ItenSources being set to the same "CollectionViewSource" object? Thank you.
Tags (comma-separated)
Save Edits
Cancel