void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ConvertUiUserControl = ((EasyBugManagerTool.ConvertUiControl)(target)); return; case 2: this.BackgroundBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.TipTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.IsCollaborationModeCheckControl = ((EasyBugManagerTool.ImageCheckControl)(target)); return; case 5: this.ForegroundCanvas = ((System.Windows.Controls.Grid)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ImageCheckUserControl = ((EasyBugManagerTool.ImageCheckControl)(target)); return; case 2: this.BaseButton = ((System.Windows.Controls.Button)(target)); #line 20 "..\..\..\..\..\Xaml\Control\Base\ImageCheckControl.xaml" this.BaseButton.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseDown); #line default #line hidden #line 21 "..\..\..\..\..\Xaml\Control\Base\ImageCheckControl.xaml" this.BaseButton.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseUp); #line default #line hidden #line 22 "..\..\..\..\..\Xaml\Control\Base\ImageCheckControl.xaml" this.BaseButton.MouseEnter += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseEnter); #line default #line hidden #line 23 "..\..\..\..\..\Xaml\Control\Base\ImageCheckControl.xaml" this.BaseButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseLeave); #line default #line hidden #line 24 "..\..\..\..\..\Xaml\Control\Base\ImageCheckControl.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; }
/// <summary> /// 依赖项属性发生改变时,触发的事件: /// 当IsCanClickProperty依赖项属性,的属性值发生改变的时候,调用这个方法 /// </summary> /// <param name="sender">依赖项对象</param> /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param> private static void OnIsCanClickChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { //获取控件 ImageCheckControl _imageCheckControl = sender as ImageCheckControl; //如果是可以点击 if ((bool)e.NewValue == true) { _imageCheckControl.BaseButton.Visibility = Visibility.Visible; _imageCheckControl.ButtonImageBorder.Opacity = 1; } //如果是不可点击 else { _imageCheckControl.BaseButton.Visibility = Visibility.Collapsed; _imageCheckControl.ButtonImageBorder.Opacity = 0.7f; } }
/// <summary> /// 依赖项属性发生改变时,触发的事件: /// 当IsCheckedProperty依赖项属性,的属性值发生改变的时候,调用这个方法 /// </summary> /// <param name="sender">依赖项对象</param> /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param> private static void OnIsCheckedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { //获取控件 ImageCheckControl _imageCheckControl = sender as ImageCheckControl; //如果是选中 if ((bool)e.NewValue == true) { /* 更改按钮的背景 */ //创建绑定数据 Binding _binding = new Binding() { ElementName = "ImageCheckUserControl", //要绑定的控件名称 Path = new PropertyPath("CheckedImage"), // 需绑定的属性名 }; //重新绑定 _imageCheckControl.ButtonImageBorder.SetBinding(BackgroundProperty, _binding); } //如果是未选中 else { /* 更改按钮的背景 */ //创建绑定数据 Binding _binding = new Binding() { ElementName = "ImageCheckUserControl", //要绑定的控件名称 Path = new PropertyPath("MouseLeaveImage"), // 需绑定的属性名 }; //重新绑定 _imageCheckControl.ButtonImageBorder.SetBinding(BackgroundProperty, _binding); } //触发事件 if ((bool)e.NewValue != (bool)e.OldValue) { _imageCheckControl.OnIsCheckedChange((bool)e.OldValue, (bool)e.NewValue);//触发事件 if ((bool)e.NewValue == true) { _imageCheckControl.OnChecked();//触发事件 } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ImageCheckGroupUserControl = ((EasyBugManagerTool.ImageCheckGroupControl)(target)); return; case 2: this.ImageCheckControl1 = ((EasyBugManagerTool.ImageCheckControl)(target)); return; case 3: this.ImageCheckControl2 = ((EasyBugManagerTool.ImageCheckControl)(target)); return; case 4: this.ImageCheckControl3 = ((EasyBugManagerTool.ImageCheckControl)(target)); return; } this._contentLoaded = true; }