첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
    xmlns:dxre="http://schemas.devexpress.com/winfx/2008/xaml/richedit"
    Width="800"
    Height="600"
    Title="메일 병합 실행하기">
    <Window.Resources>
        <ResourceDictionary>
            <dxre:RichEditUICommand x:Key="RichEditUICommandKey" />
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <dxb:BarManager x:Name="barManager"
            ToolbarGlyphSize="Small">
            <dxb:BarManager.Items>
                <dxb:BarButtonItem x:Name="fileNewBarButtonItem"
                    Command="{Binding Path=FileNew,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="fileOpenBarButtonItem"
                    Command="{Binding Path=FileOpen,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="fileSaveAsBarButtonItem"
                    Command="{Binding Path=FileSaveAs,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="filePrintBarButtonItem"
                    Command="{Binding Path=FilePrint,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="filePrintPreviewBarButtonItem"
                    Command="{Binding Path=FilePrintPreview,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="editUndoBarButtonItem"
                    Command="{Binding Path=EditUndo,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="editRedoBarButtonItem"
                    Command="{Binding Path=EditRedo,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarSubItem x:Name="mailMergeInsertFieldPlaceholderBarSubItem"
                    Command="{Binding Path=MailMergeInsertFieldPlaceholder,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}">
                    <dxb:BarSubItem.ItemLinks>
                        <dxre:InsertMergeFieldsBarListItemLink BarItemName="mailMergeInsertFieldListInsertMergeFieldsBarListItem"/>
                    </dxb:BarSubItem.ItemLinks>
                </dxb:BarSubItem>
                <dxre:InsertMergeFieldsBarListItem x:Name="mailMergeInsertFieldListInsertMergeFieldsBarListItem"
                    RichEditControl="{Binding ElementName=richEditControl}" />
                <dxb:BarCheckItem x:Name="mailMergeViewMergedDataBarCheckItem"
                    Command="{Binding Path=MailMergeViewMergedData,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeShowAllFieldCodesBarButtonItem"
                    Command="{Binding Path=MailMergeShowAllFieldCodes,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeShowAllFieldResultsBarButtonItem"
                    Command="{Binding Path=MailMergeShowAllFieldResults,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeFirstDataRecordBarButtonItem"
                    Command="{Binding Path=MailMergeFirstDataRecord,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergePreviousDataRecordBarButtonItem"
                    Command="{Binding Path=MailMergePreviousDataRecord,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeNextDataRecordBarButtonItem"
                    Command="{Binding Path=MailMergeNextDataRecord,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeLastDataRecordBarButtonItem"
                    Command="{Binding Path=MailMergeLastDataRecord,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
                <dxb:BarButtonItem x:Name="mailMergeSaveDocumentAsBarButtonItem"
                    Command="{Binding Path=MailMergeSaveDocumentAs,
                        Mode=OneTime,
                        Source={StaticResource RichEditUICommandKey}}"
                    CommandParameter="{Binding ElementName=richEditControl}" />
            </dxb:BarManager.Items>
            <DockPanel>
                <dxr:RibbonControl DockPanel.Dock="Top">
                    <dxr:RibbonDefaultPageCategory>
                        <dxr:RibbonPage x:Name="fileRibbonPage"
                            Caption="File">
                            <dxr:RibbonPageGroup x:Name="grpCommon"
                                Caption="Common">
                                <dxb:BarButtonItemLink BarItemName="fileNewBarButtonItem"          />
                                <dxb:BarButtonItemLink BarItemName="fileOpenBarButtonItem"         />
                                <dxb:BarButtonItemLink BarItemName="fileSaveAsBarButtonItem"       />
                                <dxb:BarButtonItemLink BarItemName="filePrintBarButtonItem"        />
                                <dxb:BarButtonItemLink BarItemName="filePrintPreviewBarButtonItem" />
                                <dxb:BarButtonItemLink BarItemName="editUndoBarButtonItem"         />
                                <dxb:BarButtonItemLink BarItemName="editRedoBarButtonItem"         />
                            </dxr:RibbonPageGroup>
                        </dxr:RibbonPage>
                        <dxr:RibbonPage x:Name="mailingsRibbonPage"
                            Caption="Mailings">
                            <dxr:RibbonPageGroup x:Name="writeInsertFieldsRibbonPageGroup"
                                Caption="Write &amp; Insert Fields">
                                <dxb:BarSubItemLink BarItemName="mailMergeInsertFieldPlaceholderBarSubItem" />
                            </dxr:RibbonPageGroup>
                            <dxr:RibbonPageGroup x:Name="previewResultsRibbonPageGroup"
                                Caption="Preview Results">
                                <dxb:BarCheckItemLink  BarItemName="mailMergeViewMergedDataBarCheckItem"       />
                                <dxb:BarButtonItemLink BarItemName="mailMergeShowAllFieldCodesBarButtonItem"   />
                                <dxb:BarButtonItemLink BarItemName="mailMergeShowAllFieldResultsBarButtonItem" />
                                <dxb:BarButtonItemLink BarItemName="mailMergeFirstDataRecordBarButtonItem"     />
                                <dxb:BarButtonItemLink BarItemName="mailMergePreviousDataRecordBarButtonItem"  />
                                <dxb:BarButtonItemLink BarItemName="mailMergeNextDataRecordBarButtonItem"      />
                                <dxb:BarButtonItemLink BarItemName="mailMergeLastDataRecordBarButtonItem"      />
                                <dxb:BarButtonItemLink BarItemName="mailMergeSaveDocumentAsBarButtonItem"      />
                            </dxr:RibbonPageGroup>
                        </dxr:RibbonPage>
                    </dxr:RibbonDefaultPageCategory>
                </dxr:RibbonControl>
                <dxre:RichEditControl x:Name="richEditControl"
                    BarManager="{Binding ElementName=barManager, Mode=OneTime}"
                    Loaded="richEditControl_Loaded" />
            </DockPanel>
        </dxb:BarManager>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System.Windows;

namespace TestProject
{
    /// <summary>
    /// 메인 윈도우
    /// </summary>
    public partial class MainWindow : Window
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region 리치 에디터 컨트롤 로드시 처리하기 - richEditControl_Loaded(pSender, e)

        /// <summary>
        /// 리치 에디터 컨트롤 로드시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void richEditControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.richEditControl.Options.MailMerge.DataSource     = new EmployeeList().GetData();
            this.richEditControl.Options.MailMerge.ViewMergedData = true;
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요