Exemple #1
0
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.popup            = (Popup)this.GetTemplateChild("PART_Popup");
            this.toggleDropDown   = (ToggleButton)this.GetTemplateChild("PART_ToggleButton");
            this.colorBoard       = new ColorBoard();
            this.colorBoard.Color = this.Color;

            // colorBoard.SizeChanged += colorBoard_SizeChanged;
            this.popup.Child               = this.colorBoard;
            this.colorBoard.DoneClicked   += this.colorBoard_DoneClicked;
            this.colorBoard.CancelClicked += this.colorBoard_CancelClicked;

            var b = new Binding("Color");

            b.Mode   = BindingMode.TwoWay;
            b.Source = this.colorBoard;
            this.SetBinding(CurrentColorProperty, b);

            this.KeyDown += this.ColorPicker_KeyDown;

            Window window = Window.GetWindow(this);

            window.LocationChanged += this.window_LocationChanged;
            window.SizeChanged     += this.window_SizeChanged;
            LayoutUpdated          += this.DropDownButton_LayoutUpdated;
        }
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.listBox  = (ListBox)this.GetTemplateChild("PART_List");
            this.popup    = (Popup)this.GetTemplateChild("PART_Popup_Color_Board");
            this.button   = (ButtonBase)GetTemplateChild("PART_UnselectAll");
            this.checkBox = (CheckBox)GetTemplateChild("PART_All_Visible");

            if (this.listBox != null)
            {
                this.listBox.SelectionChanged += (sender, args) => { this.SelectedColorItems = this.GetSelectedList(); };
                this.listBox.SelectionMode     = SelectionMode.Extended;
            }

            if (this.button != null)
            {
                this.button.Click += (s, e) =>
                {
                    if (listBox != null)
                    {
                        this.listBox.SelectedIndex = -1;
                    }
                };
            }

            if (this.checkBox != null)
            {
                this.checkBox.Checked   += (sender, args) => { this.IsAllVisible = true; };
                this.checkBox.Unchecked += (sender, args) => { this.IsAllVisible = false; };
            }

            this.colorBoard = new ColorBoard();
            if (this.popup != null)
            {
                this.popup.Child = this.colorBoard;
            }

            var b = new Binding("Color")
            {
                Mode = BindingMode.TwoWay, Source = this.colorBoard
            };

            this.SetBinding(EditingColorProperty, b);
            this.colorBoard.DoneClicked   += this.ColorBoardDoneClicked;
            this.colorBoard.CancelClicked += this.ColorBoardCancelClicked;
        }
Exemple #3
0
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.popup                     = (Popup)this.GetTemplateChild("PART_Popup");
            this.toggleDropDown            = (ToggleButton)this.GetTemplateChild("PART_ToggleButton");
            this.colorBoard                = new ColorBoard();
            this.colorBoard.Color          = this.Color;
            this.colorBoard.SizeChanged   += this.colorBoard_SizeChanged;
            this.popup.Child               = this.colorBoard;
            this.colorBoard.DoneClicked   += this.colorBoard_DoneClicked;
            this.colorBoard.CancelClicked += this.colorBoard_CancelClicked;

            var b = new Binding("Color");

            b.Mode   = BindingMode.TwoWay;
            b.Source = this.colorBoard;
            this.SetBinding(CurrentColorProperty, b);

            this.KeyDown += this.ColorPicker_KeyDown;
        }
Exemple #4
0
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.popup = (Popup)this.GetTemplateChild("PART_Popup");
            this.toggleDropDown = (ToggleButton)this.GetTemplateChild("PART_ToggleButton");
            this.colorBoard = new ColorBoard();
            this.colorBoard.Color = this.Color;
            this.colorBoard.SizeChanged += this.colorBoard_SizeChanged;
            this.popup.Child = this.colorBoard;
            this.colorBoard.DoneClicked += this.colorBoard_DoneClicked;
            this.colorBoard.CancelClicked += this.colorBoard_CancelClicked;

            var b = new Binding("Color");
            b.Mode = BindingMode.TwoWay;
            b.Source = this.colorBoard;
            this.SetBinding(CurrentColorProperty, b);

            this.KeyDown += this.ColorPicker_KeyDown;
        }
Exemple #5
0
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.listBox  = (ListBox)this.GetTemplateChild("PART_List");
            this.popup    = (Popup)this.GetTemplateChild("PART_Popup_Color_Board");
            this.button   = (ButtonBase)GetTemplateChild("PART_UnselectAll");
            this.checkBox = (CheckBox)GetTemplateChild("PART_All_Visible");

            var settingsButton = (DropDownButton)GetTemplateChild("PART_Settings_Button");

            if (settingsButton != null)
            {
                settingsButton.ContentLayoutUpdated += (sender, args) =>
                {
                    if (manualBindingReady)
                    {
                        return;
                    }

                    if (sender is ContentControl)
                    {
                        var settingsContent = sender as ContentControl;
                        ContentPresenter contentPresenter = FindVisualChild <ContentPresenter>(settingsContent);
                        if (contentPresenter == null)
                        {
                            return;
                        }

                        var content = contentPresenter.Content;
                        if (content == null)
                        {
                            return;
                        }

                        var qryAllChecks = (content as DependencyObject).Descendents().OfType <CheckBox>();

                        var allChecks           = qryAllChecks as CheckBox[] ?? qryAllChecks.ToArray();
                        var cbVisibilitySetting = allChecks.First(cb => cb.Name == "cbVisibilitySetting");
                        if (cbVisibilitySetting != null)
                        {
                            cbVisibilitySetting.IsChecked = this.ShowColorVisibilityControls;
                            cbVisibilitySetting.Checked  +=
                                (o, eventArgs) => { this.ShowColorVisibilityControls = true; };
                            cbVisibilitySetting.Unchecked +=
                                (o, eventArgs) => this.ShowColorVisibilityControls = false;
                        }

                        var cbColorEditingSetting = allChecks.First(cb => cb.Name == "cbColorEditingSetting");
                        if (cbColorEditingSetting != null)
                        {
                            cbColorEditingSetting.IsChecked = this.AllowColorEditing;
                            cbColorEditingSetting.Checked  +=
                                (o, eventArgs) => { this.AllowColorEditing = true; };
                            cbColorEditingSetting.Unchecked +=
                                (o, eventArgs) => this.AllowColorEditing = false;
                        }

                        var cbUseRegexSetting = allChecks.First(cb => cb.Name == "cbUseRegexSetting");
                        if (cbUseRegexSetting != null)
                        {
                            cbUseRegexSetting.IsChecked = this.UseRegexFiltering;
                            cbUseRegexSetting.Checked  +=
                                (o, eventArgs) => { this.UseRegexFiltering = true; };
                            cbUseRegexSetting.Unchecked +=
                                (o, eventArgs) => this.UseRegexFiltering = false;
                        }

                        manualBindingReady = true;
                    }
                };
            }

            if (this.listBox != null)
            {
                this.listBox.SelectionChanged += (sender, args) => { this.SelectedColorItems = this.GetSelectedList(); };
                this.listBox.SelectionMode     = SelectionMode.Extended;

                this.listBox.LayoutUpdated += (sender, args) =>
                {
                    this.UpdateVisibilityControlsVisibility();
                    this.UpdateColorEditingControlsVisibility();
                };
            }

            if (this.button != null)
            {
                this.button.Click += (s, e) =>
                {
                    if (listBox != null)
                    {
                        this.listBox.SelectedIndex = -1;
                    }
                };
            }

            if (this.checkBox != null)
            {
                this.checkBox.Checked   += (sender, args) => { this.IsAllVisible = true; };
                this.checkBox.Unchecked += (sender, args) => { this.IsAllVisible = false; };
            }

            this.colorBoard = new ColorBoard();
            if (this.popup != null)
            {
                this.popup.Child = this.colorBoard;
            }

            var b = new Binding("Color")
            {
                Mode = BindingMode.TwoWay, Source = this.colorBoard
            };

            this.SetBinding(EditingColorProperty, b);
            this.colorBoard.DoneClicked   += this.ColorBoardDoneClicked;
            this.colorBoard.CancelClicked += this.ColorBoardCancelClicked;
        }
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.listBox = (ListBox)this.GetTemplateChild("PART_List");
            this.popup = (Popup)this.GetTemplateChild("PART_Popup_Color_Board");
            this.button = (ButtonBase)GetTemplateChild("PART_UnselectAll");
            this.checkBox = (CheckBox)GetTemplateChild("PART_All_Visible");

            if (this.listBox != null)
            {
                this.listBox.SelectionChanged += (sender, args) => { this.SelectedColorItems = this.GetSelectedList(); };
                this.listBox.SelectionMode = SelectionMode.Extended;
            }

            if (this.button != null)
            {
                this.button.Click += (s, e) =>
                    {
                        if (listBox != null)
                        {
                            this.listBox.SelectedIndex = -1;
                        }
                    };
            }

            if (this.checkBox != null)
            {
                this.checkBox.Checked += (sender, args) => { this.IsAllVisible = true; };
                this.checkBox.Unchecked += (sender, args) => { this.IsAllVisible = false; };
            }

            this.colorBoard = new ColorBoard();
            if (this.popup != null)
            {
                this.popup.Child = this.colorBoard;
            }

            var b = new Binding("Color") { Mode = BindingMode.TwoWay, Source = this.colorBoard };

            this.SetBinding(EditingColorProperty, b);
            this.colorBoard.DoneClicked += this.ColorBoardDoneClicked;
            this.colorBoard.CancelClicked += this.ColorBoardCancelClicked;
        }
Exemple #7
0
        /// <summary>
        /// The on apply template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.popup = (Popup)this.GetTemplateChild("PART_Popup");
            this.toggleDropDown = (ToggleButton)this.GetTemplateChild("PART_ToggleButton");
            this.colorBoard = new ColorBoard();
            this.colorBoard.Color = this.Color;

            // colorBoard.SizeChanged += colorBoard_SizeChanged;
            this.popup.Child = this.colorBoard;
            this.colorBoard.DoneClicked += this.colorBoard_DoneClicked;
            this.colorBoard.CancelClicked += this.colorBoard_CancelClicked;

            var b = new Binding("Color");
            b.Mode = BindingMode.TwoWay;
            b.Source = this.colorBoard;
            this.SetBinding(CurrentColorProperty, b);

            this.KeyDown += this.ColorPicker_KeyDown;

            Window window = Window.GetWindow(this);
            window.LocationChanged += this.window_LocationChanged;
            window.SizeChanged += this.window_SizeChanged;
            LayoutUpdated += this.DropDownButton_LayoutUpdated;
        }