/
MainViewModel.cs
31 lines (28 loc) · 1.09 KB
/
MainViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
namespace DXSample.ViewModels {
public class MainViewModel : ViewModelBase {
protected IWindowService WindowService { get { return GetService<IWindowService>(); } }
public ChildViewModel ChildWindowViewModel {
get { return GetValue<ChildViewModel>(); }
set { SetValue(value); }
}
[Command]
public void ShowChildWindow() {
if(ChildWindowViewModel == null)
ChildWindowViewModel = new ChildViewModel() { Caption = "Hello, World!" };
WindowService.Show(ChildWindowViewModel);
}
public bool CanShowChildWindow() {
return !WindowService.IsWindowAlive;
}
[Command]
public void CloseChildWindow() {
ChildWindowViewModel = null;
WindowService.Close();
}
public bool CanCloseChildWindow() {
return WindowService.IsWindowAlive;
}
}
}