public ColorWindow() { InitializeComponent(); NamedColor nc = NamedColor.SearchByName("White")[0]; LineColor.Background = WheelColor.Background = new SolidColorBrush(nc.Color.GetWPFColor()); if (nc != null) { WheelColorName.Content = nc.Name; LineColorName.Content = nc.Name; } else { WheelColorName.Content = (nc.Color).ToString(); LineColorName.Content = (nc.Color).ToString(); } }
private static void SelectedColorNamePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is ColorElement p) { string nv = (string)e.NewValue; string ov = (string)e.OldValue; if (ov != nv) { if (string.IsNullOrEmpty(nv) || nv.StartsWith("#")) { p.SelectedNamedColors = new List <NamedColor>(); } else { p.SelectedNamedColors = NamedColor.SearchByName(nv, true); } } } }
private static void SelectedColorNamePropertyChanged(BindableObject d, object oldValue, object newValue) { if (d is ColorPicker p) { string nv = (string)newValue; string ov = (string)oldValue; if (ov != nv) { if (string.IsNullOrEmpty(nv) || nv.StartsWith("#")) { p.SelectedNamedColors = new List <NamedColor>(); } else { p.SelectedNamedColors = NamedColor.SearchByName(nv, true); } } } }