public override void OnApplyTemplate() { base.OnApplyTemplate(); FillRadioButton = GetTemplateChild("FillRadioButton") as RadioButton; if (FillRadioButton != null) FillRadioButton.Checked += new RoutedEventHandler(RadioButton_Checked); BorderRadioButton = GetTemplateChild("BorderRadioButton") as RadioButton; if(BorderRadioButton != null) BorderRadioButton.Checked += new RoutedEventHandler(RadioButton_Checked); ColorPickerSection = GetTemplateChild("ColorPickerSection") as ContentControl; FillColorPicker = GetTemplateChild("FillColorPicker") as ColorPicker; if(FillColorPicker != null) FillColorPicker.ColorChanged += new EventHandler(FillColorPicker_ColorChanged); PreDefinedColorRampControl = GetTemplateChild("PreDefinedColorRampControl") as PreDefinedColorRampControl; if (PreDefinedColorRampControl != null) PreDefinedColorRampControl.GradientBrushChanged += new EventHandler<GradientBrushChangedEventArgs>(onGradientBrushChanged); BorderColorPicker = GetTemplateChild("BorderColorPicker") as ColorPicker; if(BorderColorPicker != null) BorderColorPicker.ColorChanged += new EventHandler(BorderColorPicker_ColorChanged); FillOpacityPanel = GetTemplateChild("FillOpacityPanel") as ContentControl; FillOpacitySlider = GetTemplateChild("FillOpacitySlider") as Slider; if (FillOpacitySlider != null) FillOpacitySlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(FillSlider_ValueChanged); BorderOpacityPanel = GetTemplateChild("BorderOpacityPanel") as ContentControl; BorderOpacitySlider = GetTemplateChild("BorderOpacitySlider") as Slider; if(BorderOpacitySlider != null) BorderOpacitySlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(BorderSlider_ValueChanged); BorderWidthPanel = GetTemplateChild("BorderWidthPanel") as ContentControl; BorderWidthTextBox = GetTemplateChild("BorderWidthTextBox") as TextBox; if (BorderWidthTextBox != null) { BorderWidthTextBox.SetBinding(TextBox.TextProperty, new Binding() { Source = DataContext, Mode = BindingMode.TwoWay, Path = new PropertyPath("BorderThickness"), }); } Initialize(); if (PreDefinedColorRampControl != null) PreDefinedColorRampControl.Initialize(); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); ColorPicker = GetTemplateChild("ColorPicker") as ColorPicker; PreDefinedColorRampControl = GetTemplateChild("PreDefinedColorRampControl") as PreDefinedColorRampControl; OpacitySlider = GetTemplateChild("OpacitySlider") as Slider; WidthTextBox = GetTemplateChild("WidthTextBox") as TextBox; attachEventsAndBindings(); Initialize(); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); FillRadioButton = GetTemplateChild("FillRadioButton") as RadioButton; if (FillRadioButton != null) { FillRadioButton.Checked += new RoutedEventHandler(RadioButton_Checked); } BorderRadioButton = GetTemplateChild("BorderRadioButton") as RadioButton; if (BorderRadioButton != null) { BorderRadioButton.Checked += new RoutedEventHandler(RadioButton_Checked); } ColorPickerSection = GetTemplateChild("ColorPickerSection") as ContentControl; FillColorPicker = GetTemplateChild("FillColorPicker") as ColorPicker; if (FillColorPicker != null) { FillColorPicker.ColorChanged += new EventHandler(FillColorPicker_ColorChanged); } PreDefinedColorRampControl = GetTemplateChild("PreDefinedColorRampControl") as PreDefinedColorRampControl; if (PreDefinedColorRampControl != null) { PreDefinedColorRampControl.GradientBrushChanged += new EventHandler <GradientBrushChangedEventArgs>(onGradientBrushChanged); } BorderColorPicker = GetTemplateChild("BorderColorPicker") as ColorPicker; if (BorderColorPicker != null) { BorderColorPicker.ColorChanged += new EventHandler(BorderColorPicker_ColorChanged); } FillOpacityPanel = GetTemplateChild("FillOpacityPanel") as ContentControl; FillOpacitySlider = GetTemplateChild("FillOpacitySlider") as Slider; if (FillOpacitySlider != null) { FillOpacitySlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(FillSlider_ValueChanged); } BorderOpacityPanel = GetTemplateChild("BorderOpacityPanel") as ContentControl; BorderOpacitySlider = GetTemplateChild("BorderOpacitySlider") as Slider; if (BorderOpacitySlider != null) { BorderOpacitySlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(BorderSlider_ValueChanged); } BorderWidthPanel = GetTemplateChild("BorderWidthPanel") as ContentControl; BorderWidthTextBox = GetTemplateChild("BorderWidthTextBox") as TextBox; if (BorderWidthTextBox != null) { BorderWidthTextBox.SetBinding(TextBox.TextProperty, new Binding() { Source = DataContext, Mode = BindingMode.TwoWay, Path = new PropertyPath("BorderThickness"), }); } Initialize(); if (PreDefinedColorRampControl != null) { PreDefinedColorRampControl.Initialize(); } }