728x90
반응형
728x170
▶ MainViewModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using DevExpress.Xpf.Mvvm;
namespace HowToManageDocumentsViaTabbedDocumentUIService
{
/// <summary>
/// 메인 뷰 모델
/// </summary>
public class MainViewModel : ViewModelBase
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region Show Document Window 명령 - ShowDocumentWindowCommand
/// <summary>
/// Show Document Window 명령
/// </summary>
public ICommand ShowDocumentWindowCommand { get; private set; }
#endregion
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 문서 관리자 서비스 - DocumentManagerService
/// <summary>
/// 문서 관리자 서비스
/// </summary>
private IDocumentManagerService DocumentManagerService
{
get
{
return ServiceContainer.GetService<IDocumentManagerService>();
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainViewModel()
/// <summary>
/// 생성자
/// </summary>
public MainViewModel()
{
ShowDocumentWindowCommand = new DelegateCommand<string>(OnShowDocumentWindowCommandExecute);
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Show Document Window 명령 실행시 처리하기 - OnShowDocumentWindowCommandExecute(documentName)
/// <summary>
/// Show Document Window 명령 실행시 처리하기
/// </summary>
/// <param name="strDocumentName">문서명</param>
private void OnShowDocumentWindowCommandExecute(string documentName)
{
IDocument document = DocumentManagerService.CreateDocument(documentName, null, this);
document.Title = documentName;
document.DestroyOnClose = true;
document.Show();
}
#endregion
}
}
728x90
▶ MainView.xaml
<UserControl
x:Class="HowToManageDocumentsViaTabbedDocumentUIService.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HowToManageDocumentsViaTabbedDocumentUIService">
<UserControl.DataContext>
<local:MainViewModel />
</UserControl.DataContext>
<Grid>
<StackPanel Orientation="Horizontal">
<Button
Margin="10"
Padding="5"
FontSize="16"
Command="{Binding ShowDocumentWindowCommand}"
CommandParameter="Document1View"
Content="Show Document1 Window" />
<Button
Margin="10"
Padding="5"
FontSize="16"
Command="{Binding ShowDocumentWindowCommand}"
CommandParameter="Document2View"
Content="Show Document3 Window" />
</StackPanel>
</Grid>
</UserControl>
300x250
▶ MainWindow.xaml
<Window
x:Class="HowToManageDocumentsViaTabbedDocumentUIService.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:local="clr-namespace:HowToManageDocumentsViaTabbedDocumentUIService"
Title="TabbedDocumentUIService"
Width="800"
Height="600">
<Grid>
<dxdo:DockLayoutManager>
<dxdo:LayoutGroup Orientation="Vertical">
<dxdo:LayoutPanel
Caption="Navigation"
ItemHeight="Auto">
<local:MainView>
<dxm:Interaction.Behaviors>
<dxdo:TabbedDocumentUIService DocumentGroup="{Binding ElementName=documentGroup}" />
</dxm:Interaction.Behaviors>
</local:MainView>
</dxdo:LayoutPanel>
<dxdo:DocumentGroup x:Name="documentGroup"
Caption="Documents"
ItemHeight="*" />
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
</Grid>
</Window>
728x90
반응형
그리드형(광고전용)
'DevExpress > WPF' 카테고리의 다른 글
[DEVEXPRESS/WPF] CardView 클래스 : CardHeaderDisplayMemberBinding 속성을 사용해 카드 헤더 컨텐트 바인딩 설정하기 (0) | 2014.03.14 |
---|---|
[DEVEXPRESS/WPF] BaseColumn 클래스 : HeaderTemplate 속성을 컬럼 헤더를 정의하는 DataTemplate 설정하기 (0) | 2014.03.14 |
[DEVEXPRESS/WPF] GridColumn 엘리먼트 : EditSettings 속성을 사용해 SpinEditSettings 설정하기 (0) | 2014.03.14 |
[DEVEXPRESS/WPF] GridControl 엘리먼트 사용하기 (0) | 2014.03.14 |
[DEVEXPRESS/WPF] WindowedDocumentUIService 엘리먼트 사용하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] CurrentWindowService 엘리먼트 사용하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] LayoutPanel 엘리먼트 사용하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] DockLayoutManager 엘리먼트 사용하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] TextEdit 엘리먼트 : 2개 이상의 줄 입력하기 (0) | 2014.03.13 |
[DEVEXPRESS/WPF] DateEdit 엘리먼트 : AllowSpinOnMouseWheel 속성 사용하기 (0) | 2014.03.13 |
댓글을 달아 주세요