Burak Seyhan

Burak Seyhan

  • NA
  • 321
  • 30.1k

Listbox selectionchange event problem

Sep 19 2015 11:38 AM
Hi ,
 
I wan to learn something
 
This is my xaml page code.
<ListBox x:Name="listBox" HorizontalAlignment="Left" Height="227" Margin="10,25,0,0" VerticalAlignment="Top" Width="184" SelectionChanged="listBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
then C# code is
 
List<Product> products = new List<Product>();
products.Add(new Product() { Id = 1, Name = "Test" });
products.Add(new Product() { Id = 1, Name = "Test" });
products.Add(new Product() { Id = 1, Name = "Test" });
products.Add(new Product() { Id = 1, Name = "Test" });
listBox.ItemsSource = products;
 
 
I want to selectionchange event but always get null data  can you help me ? 

Answers (1)