<listbox x:name="listBox" margin="10,282,0,0" grid.columnspan="2" xmlns:x="#unknown"> <listbox.itemspanel> <itemspaneltemplate> <wrappanel flowdirection="LeftToRight" itemwidth="120" itemheight="120" /> </itemspaneltemplate> </listbox.itemspanel> <listbox.itemtemplate> <datatemplate> <Button x:Name="b" Click="b_Click_1" Width="120" Height="120" > <Image HorizontalAlignment="Left" Margin="-10,-10,-10,-10" x:Name="image1" Stretch="Fill" VerticalAlignment="Top" Source="{Binding}"/> </Button> </datatemplate> </listbox.itemtemplate> </listbox>
private void b_Click_1(object sender, RoutedEventArgs e) { try { MessageBoxResult a = MessageBox.Show("Are you want to upload", "Photo Upload", MessageBoxButton.OKCancel); if (a == MessageBoxResult.OK) { System.Drawing.Image b1 = (sender as Button).DataContext as System.Drawing.Image; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)