You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
3.4 KiB
83 lines
3.4 KiB
using System; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
using System.Windows.Media; |
|
using System.Windows.Media.Imaging; |
|
|
|
namespace Kingo.DataDTBJK |
|
{ |
|
/// <summary> |
|
/// UC_MenuButton.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class UC_MenuButton : UserControl |
|
{ |
|
public UC_MenuButton() |
|
{ |
|
InitializeComponent(); |
|
} |
|
|
|
|
|
public Color IconBackground |
|
{ |
|
get { return (Color)GetValue(IconBackgroundProperty); } |
|
set { SetValue(IconBackgroundProperty, value); } |
|
} |
|
|
|
// Using a DependencyProperty as the backing store for IconBackgroundProperty. This enables animation, styling, binding, etc... |
|
public static readonly DependencyProperty IconBackgroundProperty = |
|
DependencyProperty.Register("IconBackground", typeof(Color), typeof(UC_MenuButton), new PropertyMetadata(Colors.White,IconBackgroudChange)); |
|
|
|
|
|
public Color MenuBackground { |
|
get { return (Color)GetValue(MenuBackgroundProperty); } |
|
set { SetValue(MenuBackgroundProperty, value); } |
|
} |
|
|
|
public static readonly DependencyProperty MenuBackgroundProperty = |
|
DependencyProperty.Register("MenuBackground", typeof(Color), typeof(UC_MenuButton), new PropertyMetadata(Colors.White, MenuBackgroundChange)); |
|
|
|
public string ImgPath |
|
{ |
|
get { return (string)GetValue(ImgPathProperty); } |
|
set { SetValue(ImgPathProperty, value); } |
|
} |
|
|
|
// Using a DependencyProperty as the backing store for ImgPathProperty. This enables animation, styling, binding, etc... |
|
public static readonly DependencyProperty ImgPathProperty = |
|
DependencyProperty.Register("ImgPath", typeof(string), typeof(UC_MenuButton), new PropertyMetadata("",ImgPathChange)); |
|
|
|
public string MenuText |
|
{ |
|
get { return (string)GetValue(MenuTextProperty); } |
|
set { SetValue(MenuTextProperty, value); } |
|
} |
|
|
|
// Using a DependencyProperty as the backing store for MenuText. This enables animation, styling, binding, etc... |
|
public static readonly DependencyProperty MenuTextProperty = |
|
DependencyProperty.Register("MenuText", typeof(string), typeof(UC_MenuButton), new PropertyMetadata("",MenuTextChange)); |
|
|
|
private static void MenuTextChange(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
{ |
|
UC_MenuButton uC_Menu = d as UC_MenuButton; |
|
uC_Menu.txt_menuName.Text = e.NewValue as string; |
|
} |
|
|
|
private static void ImgPathChange(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
{ |
|
UC_MenuButton uC_Menu = d as UC_MenuButton; |
|
uC_Menu.img_icon.Source = new BitmapImage(new Uri($"pack://application:,,,/Images/SystemSelect/{e.NewValue as string}")); |
|
} |
|
|
|
private static void IconBackgroudChange(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
{ |
|
UC_MenuButton uC_Menu = d as UC_MenuButton; |
|
uC_Menu.border_btnbackground.Background = new SolidColorBrush((Color)e.NewValue); |
|
} |
|
|
|
private static void MenuBackgroundChange(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
{ |
|
UC_MenuButton uC_Menu = d as UC_MenuButton; |
|
uC_Menu.borderBack.Background = new SolidColorBrush((Color)e.NewValue); |
|
} |
|
} |
|
}
|
|
|