| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using Prism.Commands;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- namespace SHJX.Service.Librarys.MainLibrarys
- {
- /// <summary>
- /// TagElement.xaml 的交互逻辑
- /// </summary>
- public partial class TagElement : UserControl
- {
- public TagElement()
- {
- InitializeComponent();
- }
- public DelegateCommand ClickCommand
- {
- get => (DelegateCommand)GetValue(ClickCommandProperty);
- set => SetValue(ClickCommandProperty, value);
- }
- public static readonly DependencyProperty ClickCommandProperty =
- DependencyProperty.Register(nameof(ClickCommand), typeof(DelegateCommand), typeof(TagElement),
- new UIPropertyMetadata(null, (obj, args) =>
- {
- TagElement control = obj as TagElement;
- Button path = control?.btn_click;
- path.Command = args.NewValue as DelegateCommand;
- }));
- public ImageSource DisplayImage
- {
- get => (ImageSource)GetValue(DisplayImageProperty);
- set => SetValue(DisplayImageProperty, value);
- }
- public static readonly DependencyProperty DisplayImageProperty =
- DependencyProperty.Register(nameof(DisplayImage), typeof(ImageSource), typeof(TagElement),
- new UIPropertyMetadata(null, (obj, args) =>
- {
- var control = obj as TagElement;
- var path = control?.img_display;
- path.Source = (ImageSource)args.NewValue;
- }));
- public string TagDetail
- {
- get => (string)GetValue(TagDetailProperty);
- set => SetValue(TagDetailProperty, value);
- }
- public static readonly DependencyProperty TagDetailProperty =
- DependencyProperty.Register(nameof(TagDetail), typeof(string), typeof(TagElement),
- new UIPropertyMetadata(null, (obj, args) =>
- {
- var control = obj as TagElement;
- var path = control?.tb_tag_detail;
- path.Text = (string)args.NewValue;
- }));
- public double IconSize
- {
- get => (double)GetValue(IconSizeProperty);
- set => SetValue(IconSizeProperty, value);
- }
- public static readonly DependencyProperty IconSizeProperty =
- DependencyProperty.Register(nameof(IconSize), typeof(double), typeof(TagElement),
- new UIPropertyMetadata(0.0, (obj, args) =>
- {
- var control = obj as TagElement;
- var path = control?.img_display;
- path.Width = (double)args.NewValue;
- path.Height = (double)args.NewValue;
- }));
- }
- }
|