■ BarManager 클래스에서 BAR 버튼 항목 및 링크 간 분리자를 생성하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<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" Width="800" Height="600" Title="BarManager 클래스 : BAR 버튼 항목 및 링크 간 분리자 생성하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid> <dxb:BarManager x:Name="barManager" CreateStandardLayout="True" ItemClick="barManager_ItemClick"> <dxb:BarManager.Items> <dxb:BarButtonItem x:Name="copyBarButtonItem" Content="Delete" Glyph="pack://application:,,,/Images/copy16x16.png" /> <dxb:BarButtonItem x:Name="pasteBarButtonItem" Content="Paste" Glyph="pack://application:,,,/Images/paste16x16.png" /> <dxb:BarButtonItem x:Name="undoBarButtonItem" Content="Undo" Glyph="pack://application:,,,/Images/undo16x16.png" /> <dxb:BarButtonItem x:Name="redoBarButtonItem" Content="Redo" Glyph="pack://application:,,,/Images/redo16x16.png" /> </dxb:BarManager.Items> <dxb:BarManager.Bars> <dxb:Bar x:Name="mainMenuBar" IsMainMenu="True" BarItemHorzIndent="10" Caption="Main Menu"> <dxb:Bar.DockInfo> <dxb:BarDockInfo ContainerType="Top" Row="0" /> </dxb:Bar.DockInfo> <dxb:Bar.ItemLinks> <dxb:BarButtonItemLink BarItemName="undoBarButtonItem" /> <dxb:BarButtonItemLink BarItemName="redoBarButtonItem" /> <dxb:BarItemLinkSeparator /> <dxb:BarButtonItemLink BarItemName="copyBarButtonItem" /> <dxb:BarButtonItemLink BarItemName="pasteBarButtonItem" /> </dxb:Bar.ItemLinks> </dxb:Bar> </dxb:BarManager.Bars> <RichTextBox /> </dxb:BarManager> </Grid> </Window> |
▶ MainWindow.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
using System.Windows; using DevExpress.Xpf.Bars; namespace TestProject { /// <summary> /// 메인 윈도우 /// </summary> public partial class MainWindow : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWindow() /// <summary> /// 생성자 /// </summary> public MainWindow() { InitializeComponent(); } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region 막대 관리자 항목 클릭시 처리하기 - barManager_ItemClick(sender, e) /// <summary> /// 막대 관리자 항목 클릭시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void barManager_ItemClick(object sender, ItemClickEventArgs e) { MessageBox.Show("Item " + e.Item.Content + " has been clicked."); } #endregion } } |