private static void OnSelectedColorChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ucSmallColorPicker cp = obj as ucSmallColorPicker; Debug.Assert(cp != null); Color newColor = (Color)args.NewValue; Color oldColor = (Color)args.OldValue; if (newColor == oldColor) { return; } // When the SelectedColor changes, set the selected value of the combo box if (cp.Picker.SelectedValue == null || (Color)cp.Picker.SelectedValue != newColor) { // Add the color if not found if (!cp.ListContains(newColor)) { cp.AddColor(newColor); } } // Also update the brush cp.SelectedBrush = new SolidColorBrush(newColor); cp.OnColorChanged(oldColor, newColor); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dpName = ((System.Windows.Controls.DockPanel)(target)); return; case 2: this.iType = ((System.Windows.Controls.Image)(target)); return; case 3: this.lName = ((System.Windows.Controls.Label)(target)); return; case 4: this.lNameNumber = ((System.Windows.Controls.Label)(target)); return; case 5: this.lNameColon = ((System.Windows.Controls.Label)(target)); return; case 6: this.cbAISelection = ((System.Windows.Controls.ComboBox)(target)); #line 24 "..\..\..\Controls\ucPlayerSettings.xaml" this.cbAISelection.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cbAISelection_SelectionChanged); #line default #line hidden return; case 7: this.lAISelect = ((System.Windows.Controls.Label)(target)); return; case 8: this.scpTint = ((Dominion.NET_WPF.Controls.ucSmallColorPicker)(target)); return; case 9: this.tbName = ((System.Windows.Controls.TextBox)(target)); #line 33 "..\..\..\Controls\ucPlayerSettings.xaml" this.tbName.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.tbName_TextChanged); #line default #line hidden #line 33 "..\..\..\Controls\ucPlayerSettings.xaml" this.tbName.GotFocus += new System.Windows.RoutedEventHandler(this.tbName_GotFocus); #line default #line hidden return; } this._contentLoaded = true; }
private static void OnSelectedBrushChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ucSmallColorPicker cp = (ucSmallColorPicker)obj; SolidColorBrush newBrush = (SolidColorBrush)args.NewValue; if (cp.SelectedColor != newBrush.Color) { cp.SelectedColor = newBrush.Color; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.SmallColorPicker = ((Dominion.NET_WPF.Controls.ucSmallColorPicker)(target)); return; case 2: this.Picker = ((System.Windows.Controls.ComboBox)(target)); return; } this._contentLoaded = true; }