0
Answer

How to fire event on Bind Control with listview

Shanu Mishra

Shanu Mishra

8y
391
1
Namskaar
 
I am developing app for Windows Mobile 8.1 
I am binding textblock controls to a listview. I am able to view but unable to perform click event on items.
 
<ListView x:Name="QPCardList" ItemsSource="{Binding}" IsItemClickEnabled ="True" HorizontalAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<Image Source="{Binding src}" Margin="10,10,0,0" />
<TextBlock Text="{Binding accounttype}" HorizontalAlignment="Right" Margin="250,10,0,0" FontSize="22" />
<TextBlock Text="{Binding customername}" HorizontalAlignment="Left" Margin="10,0,0,0" FontSize="22" />
<TextBlock Text="{Binding cardend}" HorizontalAlignment="Right" Margin="250,0,0,0" FontSize="22" />
<TextBlock Text="{Binding expdate}" HorizontalAlignment="Left" Margin="10,0,0,0" FontSize="22" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
 
 
QPCardList.DataContext = new CollectionViewSource { Source = Mylist };
QPCardList.ItemClick += bt_Click;