-
[Prism] Command ObservesPropertyC#/Prism 2023. 11. 29. 13:17
프로퍼티 bool 값에 따른 Command 실행
EX)
private bool _isChecked; public bool IsChecked { get { return _isChecked; } set { SetProperty(ref _isChecked, value); } } private DelegateCommand<string> _navigateCommand; public DelegateCommand<string> NavigateCommand => //_navigateCommand ?? (_navigateCommand = new DelegateCommand<string>(ExecuteNavigateCommand).ObservesCanExecute(() => IsChecked)); _navigateCommand ?? (_navigateCommand = new DelegateCommand<string>(ExecuteNavigateCommand, canExecuteCommand).ObservesProperty(() => IsChecked)); private bool canExecuteCommand(string arg) { return IsChecked; }
728x90'C# > Prism' 카테고리의 다른 글
[Prism] Prism Samples, Library (0) 2025.01.02 [Prism] ViewModelLocator.AutoWireViewModel (0) 2024.01.09 [Prism] ActiveViews (0) 2023.11.01 [Prism] How to get a name of the active view in PRISM (1) 2023.10.30 [Prism] Apply DevExpress Theme to Prism Dialog (0) 2023.05.18 댓글