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 ?