728x90
728x170
using System.Windows.Input;
using DevExpress.Xpf.Mvvm;
/// <summary>
/// 바인딩 가능한 객체
/// </summary>
public class BindableObject : BindableBase
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// 정수 속성
/// </summary>
private int integerProperty;
/// <summary>
/// 명령 1
/// </summary>
private ICommand command1;
/// <summary>
/// 명령 2
/// </summary>
private ICommand command2;
/// <summary>
/// 명령 3
/// </summary>
private ICommand command3;
/// <summary>
/// 명령 4
/// </summary>
private ICommand command4;
/// <summary>
/// 명령 5
/// </summary>
private DelegateCommand command5;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 정수 속성 - IntegerProperty
/// <summary>
/// 정수 속성
/// </summary>
public int IntegerProperty
{
get
{
return this.integerProperty;
}
set
{
SetProperty(ref this.integerProperty, value, () => IntegerProperty, () => Command5.RaiseCanExecuteChanged());
}
}
#endregion
#region 명령 1 - Command1
/// <summary>
/// 명령 1
/// </summary>
public ICommand Command1
{
get
{
if(this.command1 == null)
{
this.command1 = new DelegateCommand(OnCommand1Execute);
}
return this.command1;
}
}
#endregion
#region 명령 2 - Command2
/// <summary>
/// 명령 2
/// </summary>
public ICommand Command2
{
get
{
if(command2 == null)
{
this.command2 = new DelegateCommand(OnCommand2Execute, OnCommand2CanExecute);
}
return this.command2;
}
}
#endregion
#region 명령 3 - Command3
/// <summary>
/// 명령 3
/// </summary>
public ICommand Command3
{
get
{
if(this.command3 == null)
{
this.command3 = new DelegateCommand<object>(OnCommand3Execute, OnCommand3CanExecute);
}
return this.command3;
}
}
#endregion
#region 명령 4 - Command4
/// <summary>
/// 명령 4
/// </summary>
public ICommand Command4
{
get
{
if(this.command4 == null)
{
this.command4 = new DelegateCommand<int>(OnCommand4Execute, OnCommand4CanExecute);
}
return this.command4;
}
}
#endregion
// 정수 속성 값 설정시 명령 5 실행 가능 여부 조사 요청 처리를 위해 ICommand가 아닌 DelegateCommand로 정의된다.
#region 명령 5 - Command5
/// <summary>
/// 명령 5
/// </summary>
public DelegateCommand Command5
{
get
{
if(this.command5 == null)
{
this.command5 = new DelegateCommand(OnCommand5Execute, OnCommand5CanExecute);
}
return this.command5;
}
}
#endregion
// 생성자에서 초기화 한다.
#region 명령 6 - Command6
/// <summary>
/// 명령 6
/// </summary>
public ICommand Command6 { get; private set; }
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - BindableObject()
/// <summary>
/// 생성자
/// </summary>
public BindableObject()
{
Command6 = new DelegateCommand(() => { /* 처리 코드 */ ; });
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 명령 1 실행시 처리하기 - OnCommand1Execute()
/// <summary>
/// 명령 1 실행시 처리하기
/// </summary>
private void OnCommand1Execute()
{
}
#endregion
#region 명령 2 실행시 처리하기 - OnCommand2Execute()
/// <summary>
/// 명령 2 실행시 처리하기
/// </summary>
private void OnCommand2Execute()
{
}
#endregion
#region 명령 2 실행 가능 여부 조사시 처리하기 - OnCommand2CanExecute()
/// <summary>
/// 명령 2 실행 가능 여부 조사시 처리하기
/// </summary>
/// <returns>명령 2 실행 가능 여부</returns>
private bool OnCommand2CanExecute()
{
return true;
}
#endregion
#region 명령 3 실행시 처리하기 - OnCommand3Execute(parameter)
/// <summary>
/// 명령 3 실행시 처리하기
/// </summary>
/// <param name="parameter">매개 변수</param>
private void OnCommand3Execute(object parameter)
{
}
#endregion
#region 명령 3 실행 가능 여부 조사시 처리하기 - OnCommand3CanExecute(parameter)
/// <summary>
/// 명령 3 실행 가능 여부 조사시 처리하기
/// </summary>
/// <param name="parameter">매개 변수</param>
/// <returns>명령 3 실행 가능 여부</returns>
private bool OnCommand3CanExecute(object parameter)
{
return true;
}
#endregion
#region 명령 4 실행시 처리하기 - OnCommand4Execute(parameter)
/// <summary>
/// 명령 4 실행시 처리하기
/// </summary>
/// <param name="parameter">매개 변수</param>
private void OnCommand4Execute(int parameter)
{
}
#endregion
#region 명령 4 실행 가능 여부 조사시 처리하기 - OnCommand4CanExecute(parameter)
/// <summary>
/// 명령 4 실행 가능 여부 조사시 처리하기
/// </summary>
/// <param name="parameter">매개 변수</param>
/// <returns>명령 4 실행 가능 여부</returns>
private bool OnCommand4CanExecute(int parameter)
{
return true;
}
#endregion
#region 명령 5 실행시 처리하기 - OnCommand5Execute()
/// <summary>
/// 명령 5 실행시 처리하기
/// </summary>
private void OnCommand5Execute()
{
}
#endregion
#region 명령 5 실행 가능 여부 조사시 처리하기 - OnCommand5CanExecute()
/// <summary>
/// 명령 5 실행 가능 여부 조사시 처리하기
/// </summary>
/// <returns>명령 5 실행 가능 여부</returns>
private bool OnCommand5CanExecute()
{
return IntegerProperty % 2 == 0;
}
#endregion
}
728x90
그리드형(광고전용)
'DevExpress > WPF' 카테고리의 다른 글
[DEVEXPRESS/WPF] ThemeManager 클래스 : ApplicationThemeName 속성을 사용해 테마 설정하기 (0) | 2014.03.13 |
---|---|
[DEVEXPRESS/WPF] ViewModelExtensions 클래스 : Parameter 첨부 속성을 사용해 뷰 모델 간 데이터 공유하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] EventToCommand 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] DXSplashScreenService 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] DialogService 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] BindableBase 클래스 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] CheckEdit 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] DXMessageBoxService 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] PageAdornerControl 엘리먼트 사용하기 (0) | 2014.03.12 |
[DEVEXPRESS/WPF] FrameNavigationService 엘리먼트 사용하기 (0) | 2014.03.12 |