728x90
728x170
▶ XAML
<Window
x:Class="HowToProcessNewValuesInLookUpEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:HowToProcessNewValuesInLookUpEdit">
...
<dxmvvm:Interaction.Behaviors>
<dx:DialogService DialogWindowStartupLocation="CenterOwner">
<dx:DialogService.ViewTemplate>
<DataTemplate>
<local:ProductControl />
</DataTemplate>
</dx:DialogService.ViewTemplate>
<dx:DialogService.DialogStyle>
<Style TargetType="dx:DXDialogWindow">
<Setter Property="Width" Value="340" />
<Setter Property="Height" Value="340" />
</Style>
</dx:DialogService.DialogStyle>
</dx:DialogService>
</dxmvvm:Interaction.Behaviors>
</Window>
728x90
▶ C#
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;
using DevExpress.Xpf.Mvvm;
/// <summary>
/// 제품 리스트 뷰 모델
/// </summary>
public class ProductListViewModel : ViewModelBase
{
...
#region 대화 상자 서비스 - DialogService
/// <summary>
/// 대화 상자 서비스
/// </summary>
public IDialogService DialogService
{
get
{
return GetService<IDialogService>();
}
}
#endregion
...
Product product = new Product() { ProductName = strParameter };
UICommand addProductUICommand = new UICommand()
{
Caption = "Add",
IsCancel = false,
IsDefault = true
};
UICommand cancelProductUICommand = new UICommand()
{
Caption = "Cancel",
IsDefault = false,
IsCancel = true
};
UICommand resultUICommand = DialogService.ShowDialog(new List<UICommand>() { addProductUICommand, cancelProductUICommand}, "Add New Product", product);
if(resultUICommand == addProductUICommand)
{
this.productCollection.Add(product);
}
...
}
※ ProductControl는 UserControl을 상속받은 클래스이다.
※ Product는 모델 클래스이다.
728x90
그리드형(광고전용)
'DevExpress > WPF' 카테고리의 다른 글
[DEVEXPRESS/WPF] BarButtonItem 엘리먼트 : Command 속성 사용하기 (0) | 2014.04.15 |
---|---|
[DEVEXPRESS/WPF] InsertMainMenuIfNotExistAction 엘리먼트 사용하기 (0) | 2014.04.14 |
[DEVEXPRESS/WPF] RemoveBarItemAndLinkAction 엘리먼트 사용하기 (0) | 2014.04.14 |
[DEVEXPRESS/WPF] BarManagerActionContainer 엘리먼트 사용하기 (0) | 2014.04.14 |
[DEVEXPRESS/WPF] EventToCommand 엘리먼트 : ProcessNewValue 이벤트 발생시 명령 실행하기 (0) | 2014.03.31 |
[DEVEXPRESS/WPF] GroupFrame 엘리먼트 사용하기 (0) | 2014.03.31 |
[DEVEXPRESS/WPF] ToolbarListItem 엘리먼트 사용하기 (0) | 2014.03.31 |
[DEVEXPRESS/WPF] BarLinkContainerItem 엘리먼트 사용하기 (0) | 2014.03.31 |
[DEVEXPRESS/WPF] BarEditItem 엘리먼트 : 스핀 에디터 사용하기 (0) | 2014.03.31 |
[DEVEXPRESS/WPF] BarEditItem 엘리먼트 : 날짜 에디터 사용하기 (0) | 2014.03.31 |