[Avalonia] Execute , CanExecute
by #독개#
axaml
<TextBox Watermark="프로세스명 입력" Text="{Binding ProcessName}"> </TextBox>
<TextBox Watermark="Class명 입력" Text="{Binding ClassName}"> </TextBox>
<Button Content="스크린샷 찍기" Command="{Binding Capture}"></Button>
ViewModel
private string _ProcessName;
public string ProcessName { get => _ProcessName; set { this.RaiseAndSetIfChanged(ref _ProcessName, value); } }
private string _ClassName;
public string ClassName { get => _ClassName; set { this.RaiseAndSetIfChanged(ref _ClassName, value); } }
public void Capture()
{
//캡쳐버튼 눌렀을때 Execute
}
[DependsOn(nameof(ProcessName)),DependsOn(nameof(ClassName))] //Depends On 걸어줘야 트리거연결
public bool CanCapture(object obj)
{
if (!string.IsNullOrEmpty(ProcessName) || !string.IsNullOrEmpty(ClassName))
return true;
return false;
}
'🏹 프로그래밍 활용 > Avalonia' 카테고리의 다른 글
[Avalonia] Open File Dialog Use Example (0) | 2022.12.20 |
---|---|
[Avalonia] Settings.Setting 사용하기 (0) | 2022.12.19 |
[Avalonia] 화면캡쳐 with Wpf (0) | 2022.12.18 |
[OpenCV] Winform, Wpf, Avalonia (1) | 2022.12.18 |
[Avalonia] Drop File (0) | 2022.12.17 |
블로그의 정보
독한 개발자
#독개#