-
[WPF]CommandC#/WPF 2022. 12. 14. 10:34
ViewModel에 정의 되어있는 Command 호출방법.
정의 되어있는 Command
private DelegateCommand<string> copySelectedDeviceCommand; public DelegateCommand<string> CopySelectedDeviceCommand => copySelectedDeviceCommand ?? (copySelectedDeviceCommand = new DelegateCommand<string>(ExecuteCopySelectedDeviceCommand)); void ExecuteCopySelectedDeviceCommand(string parameter) { Clipboard.SetText(SelectedDeviceName); }
호출
CopySelectedDeviceCommand.Execute(null);
Type에 맞는 제네릭 파라미터로 전달. Ex) string, object, etc.
728x90'C# > WPF' 카테고리의 다른 글
[WPF] DevExpress Error_NU1102 (0) 2022.12.16 [WPF]Unit Test (0) 2022.12.14 [WPF]Close Window in ViewModel (0) 2022.12.09 [WPF] Focus to specific Control (0) 2022.12.09 [WPF] Resource Dictionary (0) 2022.12.02 댓글