public void AddPicBox() { var picBox = new UserPicBox(DefaultImage); picBox.Width = StackPicContainer.ActualWidth; picBox.MouseLeftButtonUp += picBox_Click; StackPicContainer.Children.Remove(BtnAdd); StackPicContainer.Children.Add(picBox); StackPicContainer.Children.Add(BtnAdd); _picBoxList.Add(picBox); //picBox.ShowLast(); }
private void picBox_Click(object sender, MouseButtonEventArgs e) { CurrentSelectedPicBox = sender as UserPicBox; foreach (var child in StackPicContainer.Children) { if (child is UserPicBox picBox) { picBox.Background = Brushes.White; } } CurrentSelectedPicBox.Background = Brushes.Red; }