private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { PickedColor.R = (short)RedSlider.Value; PickedColor.G = (short)GreenSlider.Value; PickedColor.B = (short)BlueSlider.Value; HxValueBlock.Text = PickedColor.AsHex(); ColorPickerPickedColor = PickedColor; if (PickedColor.IsLegal()) { ColorRectangle.Fill = new SolidColorBrush(PickedColor); RedTextBox.Background = GreenTextBox.Background = BlueTextBox.Background = SelectBG(PickedColor, ChosenProv?.province); } else { ColorRectangle.Fill = new SolidColorBrush(Colors.Transparent); RedTextBox.Background = LegalBG(PickedColor.R); GreenTextBox.Background = LegalBG(PickedColor.G); BlueTextBox.Background = LegalBG(PickedColor.B); } RedTextBox.ChannelTooltip(PickedColor.R); GreenTextBox.ChannelTooltip(PickedColor.G); BlueTextBox.ChannelTooltip(PickedColor.B); NewProvLegal(); }
void updateRGB() { R = TruncateFloat(red * 256, 0, 255); G = TruncateFloat(green * 256, 0, 255); B = TruncateFloat(blue * 256, 0, 255); RedTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); GreenTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); BlueTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); }
/// <summary> /// Make a shadow copy of the element at the current state which stays available even the element is gone. /// </summary> /// <returns>A shadow copy of the current element.</returns> public new BasicColorPickerDialogData GetDataCopy() { var data = new BasicColorPickerDialogData(); FillData(data); data.ColorsSection = GetSafeData(() => { if (ColorsSection == null) { return(null); } return(ColorsSection.GetDataCopy()); }); data.DefineColorsButton = GetSafeData(() => { if (DefineColorsButton == null) { return(null); } return(DefineColorsButton.GetDataCopy()); }); data.ColorPickSection = GetSafeData(() => { if (ColorPickSection == null) { return(null); } return(ColorPickSection.GetDataCopy()); }); data.ColorGradientSection = GetSafeData(() => { if (ColorGradientSection == null) { return(null); } return(ColorGradientSection.GetDataCopy()); }); data.ColorDisplaySection = GetSafeData(() => { if (ColorDisplaySection == null) { return(null); } return(ColorDisplaySection.GetDataCopy()); }); data.ColorShadeTextBox = GetSafeData(() => { if (ColorShadeTextBox == null) { return(null); } return(ColorShadeTextBox.GetDataCopy()); }); data.ColorChromaTextBox = GetSafeData(() => { if (ColorChromaTextBox == null) { return(null); } return(ColorChromaTextBox.GetDataCopy()); }); data.ColorBrightnessTextBox = GetSafeData(() => { if (ColorBrightnessTextBox == null) { return(null); } return(ColorBrightnessTextBox.GetDataCopy()); }); data.RedTextBox = GetSafeData(() => { if (RedTextBox == null) { return(null); } return(RedTextBox.GetDataCopy()); }); data.GreenTextBox = GetSafeData(() => { if (GreenTextBox == null) { return(null); } return(GreenTextBox.GetDataCopy()); }); data.BlueTextBox = GetSafeData(() => { if (BlueTextBox == null) { return(null); } return(BlueTextBox.GetDataCopy()); }); data.ApplyColorButton = GetSafeData(() => { if (ApplyColorButton == null) { return(null); } return(ApplyColorButton.GetDataCopy()); }); data.OKButton = GetSafeData(() => { if (OKButton == null) { return(null); } return(OKButton.GetDataCopy()); }); data.CancelButton = GetSafeData(() => { if (CancelButton == null) { return(null); } return(CancelButton.GetDataCopy()); }); data.HelpButton = GetSafeData(() => { if (HelpButton == null) { return(null); } return(HelpButton.GetDataCopy()); }); return(data); }