I am working with listview control in win8. I want to add an event when I hold an element and delete the element.
xaml code and events as follows:
<ListView x:Name="ImageList" VerticalAlignment="Bottom" Background="LightGray" Width="1050" BorderBrush="Black" BorderThickness="2" Grid.Column="1" Holding="ListView_Hold1" SelectionChanged="OnSelectedChanged" SelectionMode="Single" Height="152" ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemContainerStyle="{StaticResource ListViewItemStyle1}" Style="{StaticResource ListViewStyle1}"> <ListView.ItemTemplate> <DataTemplate> <Image Opacity="0.7" Width="150" Height="125" Stretch="UniformToFill" Source="{Binding}" /> </DataTemplate> </ListView.ItemTemplate> <ListView.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ListView.ItemsPanel> </ListView> private async void ListView_Hold1(object sender, Windows.UI.Xaml.Input.HoldingRoutedEventArgs e) {...}
It seems that I cannot get the information from holdroutdEventArgs, but the attribute is originalsource. But this is an image and in no way access to iteml
I found a relative question: "how to get a clicked item in a list." it can be solved by receiving the selecteditem attribute.
Can anybody help me? give me a hint.
source share