Exemplo n.º 1
0
        private static void OnSelectedBrushPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            TabColorPicker currentInstance = (TabColorPicker)sender;

            if (!currentInstance.isTemplateApplied)
            {
                return;
            }

            GeoBrush geoBrush = (GeoBrush)e.NewValue;

            currentInstance.SetSelectedBrush(geoBrush);
        }
Exemplo n.º 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            colorPicker = GetTemplateChild("ColorPicker") as TabColorPicker;
            colorPicker.IsSolidColorBrushTabEnabled    = IsSolidColorBrushTabEnabled;
            colorPicker.IsGradientColorBrushTabEnabled = IsGradientColorBrushTabEnabled;
            colorPicker.IsHatchBrushTabEnabled         = IsHatchBrushTabEnabled;
            colorPicker.IsTextureBrushTabEnabled       = IsTextureBrushTabEnabled;
            colorPicker.SelectedItemDoubleClick       -= new MouseButtonEventHandler(ColorPicker_SelectedItemDoubleClick);
            colorPicker.SelectedItemDoubleClick       += new MouseButtonEventHandler(ColorPicker_SelectedItemDoubleClick);

            toggleButton = GetTemplateChild("ToggleButton") as ToggleButton;
            slider       = GetTemplateChild("Slider") as Slider;

            colorPickerPanel = GetTemplateChild("ColorPickerPanel") as Grid;
            if (colorPickerPanel != null)
            {
                colorPickerPanel.MouseEnter -= new MouseEventHandler(ColorPickerPanel_MouseEnter);
                colorPickerPanel.MouseEnter += new MouseEventHandler(ColorPickerPanel_MouseEnter);
                colorPickerPanel.MouseLeave -= new MouseEventHandler(ColorPickerPanel_MouseLeave);
                colorPickerPanel.MouseLeave += new MouseEventHandler(ColorPickerPanel_MouseLeave);
            }
        }