private void Color_Edit(object sender, RoutedEventArgs e) { DominoColor color = (DominoColor)((Button)sender).DataContext; ColorControl c = new ColorControl(); c.ColorPicker.SelectedColor = color.rgb; c.count = color.count; c.name = color.name; c.ShowDialog(); if (c.DialogResult == true) { color.rgb = c.ColorPicker.SelectedColor; color.name = c.name; color.count = c.count; } DependencyObject parent = VisualTreeHelper.GetParent(sender as DependencyObject); while (!(parent is ListView)) { parent = VisualTreeHelper.GetParent(parent as DependencyObject); } List <DominoColor> colors = ((ListView)parent).ItemsSource as List <DominoColor>; (parent as ListView).Items.Refresh(); }
private void SelectColorButton(object sender, RoutedEventArgs e) { Filter f = (sender as Button).DataContext as Filter; ColorControl c = new ColorControl(); c.Show_Only_Color = true; if (f is BackgroundColorFilter) { BackgroundColorFilter b = f as BackgroundColorFilter; c.ColorPicker.SelectedColor = FieldPlanDocument.SDtoSM(b.color); if (c.ShowDialog() == true) { b.color = FieldBlockViewer.SMtoSD(c.ColorPicker.SelectedColor); } } if (f is ReplaceFilter) { ReplaceFilter b = f as ReplaceFilter; if ((sender as Button).ToolTip.ToString() == "First Color") { c.ColorPicker.SelectedColor = FieldPlanDocument.SDtoSM(b.source); if (c.ShowDialog() == true) { b.source = FieldBlockViewer.SMtoSD(c.ColorPicker.SelectedColor); } } else { c.ColorPicker.SelectedColor = FieldPlanDocument.SDtoSM(b.target); if (c.ShowDialog() == true) { b.target = FieldBlockViewer.SMtoSD(c.ColorPicker.SelectedColor); } } } if (f is TintFilter) { TintFilter b = f as TintFilter; c.ColorPicker.SelectedColor = FieldPlanDocument.SDtoSM(b.color); if (c.ShowDialog() == true) { b.color = FieldBlockViewer.SMtoSD(c.ColorPicker.SelectedColor); } } if (f is VignetteFilter) { VignetteFilter b = f as VignetteFilter; c.ColorPicker.SelectedColor = FieldPlanDocument.SDtoSM(b.color); if (c.ShowDialog() == true) { b.color = FieldBlockViewer.SMtoSD(c.ColorPicker.SelectedColor); } } Redraw(); OnPropertyChanged(null); }
private void Color_Edit(object sender, RoutedEventArgs e) { DominoColor color = (DominoColor)((Button)sender).DataContext; ColorControl c = new ColorControl(); c.ColorPicker.SelectedColor = color.rgb; c.count = color.count; c.name = color.name; c.ColorOnly = true; c.ShowDialog(); if (c.DialogResult == true) { color.rgb = c.ColorPicker.SelectedColor; color.name = c.name; color.count = c.count; } temp.Colors[color.used_in_projects[0]] = color; lvColors.Items.Refresh(); }
private void AddColor(object sender, RoutedEventArgs e) { DependencyObject parent = VisualTreeHelper.GetParent(sender as DependencyObject); parent = VisualTreeHelper.GetChild(parent, 0); List <DominoColor> colors = ((ListView)parent).ItemsSource as List <DominoColor>; DominoColor color = new DominoColor("New Color", Color.FromRgb(0, 0, 0), 1000); ColorControl c = new ColorControl(); c.ColorPicker.SelectedColor = color.rgb; c.count = color.count; c.name = color.name; c.ShowDialog(); if (c.DialogResult == true) { color.rgb = c.ColorPicker.SelectedColor; color.name = c.name; color.count = c.count; } colors.Add(color); (parent as ListView).Items.Refresh(); (parent as ListView).ScrollIntoView((parent as ListView).Items.GetItemAt(colors.Count - 1)); }
private void ChangeColor(object sender, RoutedEventArgs e) { ColorControl c = new ColorControl(); c.ColorOnly = true; if (((Button)sender).Name.ToString() == "BackColor") { c.ColorPicker.SelectedColor = ((FieldPlanDocument)this.DataContext).fixed_back_color; } else { c.ColorPicker.SelectedColor = ((FieldPlanDocument)this.DataContext).fixed_fore_color; } c.ShowDialog(); if (((Button)sender).Name.ToString() == "BackColor") { ((FieldPlanDocument)this.DataContext).fixed_back_color = c.ColorPicker.SelectedColor; } else { ((FieldPlanDocument)this.DataContext).fixed_fore_color = c.ColorPicker.SelectedColor; } }