mirror of
https://github.com/DevExpress/netcore-winforms-demos.git
synced 2025-12-22 17:39:24 +00:00
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
namespace DevExpress.DevAV.Modules {
|
|
using DevExpress.DevAV.ViewModels;
|
|
|
|
public partial class ViewSettingsControl : BaseModuleControl {
|
|
public ViewSettingsControl(CollectionUIViewModel collectionViewModel)
|
|
: base(typeof(ViewSettingsViewModel), new object[] { collectionViewModel }) {
|
|
InitializeComponent();
|
|
BindCommands();
|
|
}
|
|
public ViewSettingsViewModel ViewModel {
|
|
get { return GetViewModel<ViewSettingsViewModel>(); }
|
|
}
|
|
void BindCommands() {
|
|
this.resetFiltersBtn.BindCommand(() => ViewModel.ResetCustomFilters(), ViewModel);
|
|
this.resetViewBtn.BindCommand(() => ViewModel.ResetView(), ViewModel);
|
|
//
|
|
this.okBtn.BindCommand(() => ViewModel.OK(), ViewModel);
|
|
this.cancelBtn.BindCommand(() => ViewModel.Cancel(), ViewModel);
|
|
}
|
|
}
|
|
}
|
|
namespace DevExpress.DevAV.ViewModels {
|
|
using DevExpress.Mvvm;
|
|
using DevExpress.Mvvm.DataAnnotations;
|
|
using DevExpress.Mvvm.POCO;
|
|
|
|
public class ViewSettingsViewModel {
|
|
CollectionUIViewModel collectionUIViewModelCore;
|
|
|
|
public static ViewSettingsViewModel Create(CollectionUIViewModel collectionUIViewModel) {
|
|
return ViewModelSource.Create(() => new ViewSettingsViewModel(collectionUIViewModel));
|
|
}
|
|
protected ViewSettingsViewModel(CollectionUIViewModel collectionUIViewModel) {
|
|
this.collectionUIViewModelCore = collectionUIViewModel;
|
|
}
|
|
[Command]
|
|
public void ResetCustomFilters() {
|
|
var vm = ViewModelHelper.GetParentViewModel<ISupportCustomFilters>(this);
|
|
if(vm != null)
|
|
vm.ResetCustomFilters();
|
|
}
|
|
public CollectionUIViewModel CollectionUIViewModel {
|
|
get { return collectionUIViewModelCore; }
|
|
}
|
|
[Command]
|
|
public void ResetView() {
|
|
CollectionUIViewModel.ResetView();
|
|
}
|
|
public IDocument Document { get; set; }
|
|
[Command]
|
|
public void OK() {
|
|
Document.Close();
|
|
}
|
|
[Command]
|
|
public void Cancel() {
|
|
Document.Close();
|
|
}
|
|
}
|
|
} |