/// <summary> /// 依赖项属性发生改变时,触发的事件: /// 当PriorityTypeProperty依赖项属性,的属性值发生改变的时候,调用这个方法 /// </summary> /// <param name="sender">依赖项对象</param> /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param> private static void OnPriorityTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { //获取控件 PriorityBubbleButtonControl _priorityBubbleButtonControl = sender as PriorityBubbleButtonControl; //判断值 switch ((PriorityType)e.NewValue) { //如果是空 case PriorityType.None: _priorityBubbleButtonControl.TextBorder.Background = null; break; //如果是低 case PriorityType.Low: _priorityBubbleButtonControl.TextBorder.Background = _priorityBubbleButtonControl.LowImage; break; //如果是中 case PriorityType.Mid: _priorityBubbleButtonControl.TextBorder.Background = _priorityBubbleButtonControl.MidImage; break; //如果是高 case PriorityType.High: _priorityBubbleButtonControl.TextBorder.Background = _priorityBubbleButtonControl.HighImage; break; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PriorityBubbleButtonUserControl = ((EasyBugManager.PriorityBubbleButtonControl)(target)); return; case 2: this.BaseButton = ((System.Windows.Controls.Button)(target)); #line 22 "..\..\..\..\..\..\Xaml\Control\Perfab\BugUi\PriorityBubbleButtonControl.xaml" this.BaseButton.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseDown); #line default #line hidden #line 23 "..\..\..\..\..\..\Xaml\Control\Perfab\BugUi\PriorityBubbleButtonControl.xaml" this.BaseButton.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.Button_OnPreviewMouseUp); #line default #line hidden #line 24 "..\..\..\..\..\..\Xaml\Control\Perfab\BugUi\PriorityBubbleButtonControl.xaml" this.BaseButton.MouseEnter += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseEnter); #line default #line hidden #line 25 "..\..\..\..\..\..\Xaml\Control\Perfab\BugUi\PriorityBubbleButtonControl.xaml" this.BaseButton.MouseLeave += new System.Windows.Input.MouseEventHandler(this.BaseButton_OnMouseLeave); #line default #line hidden #line 26 "..\..\..\..\..\..\Xaml\Control\Perfab\BugUi\PriorityBubbleButtonControl.xaml" this.BaseButton.Click += new System.Windows.RoutedEventHandler(this.Button_OnClick); #line default #line hidden return; case 3: this.BubbleBorder = ((System.Windows.Controls.Border)(target)); return; case 4: this.TextBorder = ((System.Windows.Controls.Border)(target)); return; case 5: this.BaseButtonScaleTransform = ((System.Windows.Media.ScaleTransform)(target)); return; } this._contentLoaded = true; }