static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { ColorPickerButton picker = obj as ColorPickerButton; if (picker != null) { Color color = picker.Value; picker.border.Background = new SolidColorBrush(color); // find a foreground color that is visible on the background if (color.A < 128) { picker.textBlock.Foreground = SystemColors.WindowTextBrush; } else if (0.299f * color.R + 0.587f * color.G + 0.114f * color.B > 128) { picker.textBlock.Foreground = Brushes.Black; } else { picker.textBlock.Foreground = Brushes.WhiteSmoke; } picker.textBlock.Text = picker.Text ?? color.ToString(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.colorPicker = ((ICSharpCode.SharpDevelop.Gui.ColorPickerButton)(target)); return; case 2: this.button = ((System.Windows.Controls.Button)(target)); #line 7 "..\..\..\..\..\Src\Gui\Components\ColorPickerButton.xaml" this.button.Click += new System.Windows.RoutedEventHandler(this.ButtonClick); #line default #line hidden return; case 3: this.border = ((System.Windows.Controls.Border)(target)); return; case 4: this.textBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.bytesPerLine = ((ICSharpCode.SharpDevelop.Widgets.NumericUpDown)(target)); return; case 2: this.viewModes = ((System.Windows.Controls.ComboBox)(target)); return; case 3: this.offsetColorPicker = ((ICSharpCode.SharpDevelop.Gui.ColorPickerButton)(target)); return; case 4: this.offsetFontButton = ((System.Windows.Controls.Button)(target)); #line 41 "..\..\..\..\Src\View\HexEditOptionsPanel.xaml" this.offsetFontButton.Click += new System.Windows.RoutedEventHandler(this.FontChooserClick); #line default #line hidden return; case 5: this.dataColorPicker = ((ICSharpCode.SharpDevelop.Gui.ColorPickerButton)(target)); return; case 6: this.dataFontButton = ((System.Windows.Controls.Button)(target)); #line 47 "..\..\..\..\Src\View\HexEditOptionsPanel.xaml" this.dataFontButton.Click += new System.Windows.RoutedEventHandler(this.FontChooserClick); #line default #line hidden return; case 7: this.offsetPreview = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.dataPreview = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.colorPicker = ((ICSharpCode.SharpDevelop.Gui.ColorPickerButton)(target)); return; case 2: this.button = ((System.Windows.Controls.Button)(target)); #line 7 "..\..\..\..\..\Src\Gui\Components\ColorPickerButton.xaml" this.button.Click += new System.Windows.RoutedEventHandler(this.ButtonClick); #line default #line hidden return; case 3: this.border = ((System.Windows.Controls.Border)(target)); return; case 4: this.textBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }