当前位置: 首页> 汽车> 维修 > 网络规划设计师2022论文5月_互联网全媒体广告代理_百度一下你就知道官网_海外推广营销系统

网络规划设计师2022论文5月_互联网全媒体广告代理_百度一下你就知道官网_海外推广营销系统

时间:2025/7/12 9:34:52来源:https://blog.csdn.net/h2004118/article/details/146501641 浏览次数: 1次
网络规划设计师2022论文5月_互联网全媒体广告代理_百度一下你就知道官网_海外推广营销系统

1.引用类

using System.ComponentModel

2.创建Command自定义类

 public class DelegateCommand : ICommand{public bool CanExecute(object parameter){if (CanExecuteFunc == null)return true;return this.CanExecuteFunc(parameter);}public event EventHandler CanExecuteChanged;public void Execute(object parameter){if (ExecuteAction == null){return;}this.ExecuteAction(parameter);}public Action<object> ExecuteAction { get; set; }public Func<object, bool> CanExecuteFunc { get; set; }}

3.ViewModel层实现数据绑定、Command事件点击

public class MainViewModel : INotifyPropertyChanged
{public event PropertyChangedEventHandler PropertyChanged;public MainViewModel(){#必需初始化时就加载才生效this.SelectFileNameCommand = new DelegateCommand();this.SelectFileNameCommand.ExecuteAction = new Action<object>(this.SelectFileName);}/// <summary>/// 当前时间/// </summary>private string currentTimer;public string CurrentTimer{get{return currentTimer;}set{currentTimer = value;if (this.PropertyChanged != null){this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CurrentTimer"));}}}public DelegateCommand DoubleClickNotifyCommand { get; set; }private void DoubleClickNotify(object parameter){}}

4.界面按钮绑定事件

<ButtonMargin="0,0,5,0"Command="{Binding DoubleClickNotifyCommand }"Content="{DynamicResource Setting_File}"FontSize="20"Foreground="White" />
关键字:网络规划设计师2022论文5月_互联网全媒体广告代理_百度一下你就知道官网_海外推广营销系统

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: