Ejemplo n.º 1
0
        /// <summary>
        /// 依赖项属性发生改变时,触发的事件:
        /// 当IsCheckedProperty依赖项属性,的属性值发生改变的时候,调用这个方法
        /// </summary>
        /// <param name="sender">依赖项对象</param>
        /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param>
        private static void OnIsCheckedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //获取控件
            ColorCheckControl _colorCheckControl = sender as ColorCheckControl;

            //如果是选中
            if ((bool)e.NewValue == true)
            {
                _colorCheckControl.CurrentBackground  = _colorCheckControl.CheckedBackground;
                _colorCheckControl.CurrentBorderBrush = _colorCheckControl.CheckedBorderBrush;
            }
            //如果是未选中
            else
            {
                _colorCheckControl.CurrentBackground  = _colorCheckControl.MouseLeaveBackground;
                _colorCheckControl.CurrentBorderBrush = _colorCheckControl.MouseLeaveBorderBrush;
            }

            //触发事件
            if ((bool)e.NewValue != (bool)e.OldValue)
            {
                _colorCheckControl.OnIsCheckedChange((bool)e.OldValue, (bool)e.NewValue);//触发事件


                if ((bool)e.NewValue == true)
                {
                    _colorCheckControl.OnChecked();//触发事件
                }
            }
        }
Ejemplo n.º 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ColorCheckUserControl = ((EasyBugManagerTool.ColorCheckControl)(target));
                return;

            case 2:
                this.BaseButton = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\..\..\..\Xaml\Control\Base\ColorCheckControl.xaml"
                this.BaseButton.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseDown);

            #line default
            #line hidden

            #line 19 "..\..\..\..\..\Xaml\Control\Base\ColorCheckControl.xaml"
                this.BaseButton.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseUp);

            #line default
            #line hidden

            #line 20 "..\..\..\..\..\Xaml\Control\Base\ColorCheckControl.xaml"
                this.BaseButton.MouseEnter += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseEnter);

            #line default
            #line hidden

            #line 21 "..\..\..\..\..\Xaml\Control\Base\ColorCheckControl.xaml"
                this.BaseButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseLeave);

            #line default
            #line hidden

            #line 22 "..\..\..\..\..\Xaml\Control\Base\ColorCheckControl.xaml"
                this.BaseButton.Click += new System.Windows.RoutedEventHandler(this.Button_OnClick);

            #line default
            #line hidden
                return;

            case 3:
                this.ButtonImageBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 4:
                this.BaseButtonScaleTransform = ((System.Windows.Media.ScaleTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 依赖项属性发生改变时,触发的事件:
        /// 当IsCanClickProperty依赖项属性,的属性值发生改变的时候,调用这个方法
        /// </summary>
        /// <param name="sender">依赖项对象</param>
        /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param>
        private static void OnIsCanClickChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //获取控件
            ColorCheckControl _colorCheckControl = sender as ColorCheckControl;

            //如果是可以点击
            if ((bool)e.NewValue == true)
            {
                _colorCheckControl.BaseButton.Visibility     = Visibility.Visible;
                _colorCheckControl.ButtonImageBorder.Opacity = 1;
            }
            //如果是不可点击
            else
            {
                _colorCheckControl.BaseButton.Visibility     = Visibility.Collapsed;
                _colorCheckControl.ButtonImageBorder.Opacity = 0.7f;
            }
        }