How can I bind a LinkedList as ItemSource to ListView in WPF XAML?
- by Jonas
I'm learning WPF and would like to have a collection similar to a LinkedList, to where I can add and remove strings. And I want to have a ListView that listen to that collection with databinding. How can I do bind a simple list collection to a ListView in XAML?
My idea (not working) is something like this:
<Window ...>
<Window.Resources>
<LinkedList x:Key="myList"></LinkedList>
<Window.Resources>
<Grid>
<ListView Height="100" HorizontalAlignment="Left" Margin="88,134,0,0"
Name="listView1" VerticalAlignment="Top" Width="120"
ItemsSource="{Binding Source={StaticResource myList}}"/>
</Grid>
</Window>