private void SelectImage(object sender, RoutedEventArgs e) { Button b = sender as Button; ClientEntities.Image image = b.CommandParameter as ClientEntities.Image; selectedImage = image; this.DataContext = selectedImage; }
public Pictures() { imageService = new SimpleImageService(new SimpleConnectionCreater()); InitializeComponent(); myPictures = new ObservableCollection <ClientEntities.Image>(imageService.GetAll()); if (myPictures.ToArray().Length > 0) { selectedImage = myPictures.ToArray()[0]; } pictures.ItemsSource = myPictures; this.DataContext = selectedImage; }