■ BarManagerActionContainer 엘리먼트를 사용하는 방법을 보여준다.
▶ 예제 코드 (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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
<Window.Resources> <DataTemplate x:Key="DataTemplateKey1"> <dxb:BarManagerActionContainer> <dxb:CreateStandardLayoutAction /> <dxb:InsertMainMenuIfNotExistAction> <dxb:InsertMainMenuIfNotExistAction.Bar> <dxb:Bar x:Name="mainMenu" UseWholeRow="True" Caption="Main menu"> <dxb:Bar.DockInfo> <dxb:BarDockInfo ContainerType="Top" /> </dxb:Bar.DockInfo> </dxb:Bar> </dxb:InsertMainMenuIfNotExistAction.Bar> </dxb:InsertMainMenuIfNotExistAction> <dxb:BarSubItem x:Name="fileBarSubItem" dxb:BarItemLinkActionBase.TargetType="mainMenu" dxb:BarItemLinkActionBase.ItemLinkIndex="0" Content="File" /> <dxb:BarButtonItem x:Name="newBarButtonItem" dxb:BarItemLinkActionBase.Target="fileBarSubItem" dxb:BarItemLinkActionBase.ItemLinkIndex="0" Content="New" /> <dxb:BarButtonItem x:Name="openBarButtonItem" dxb:BarItemLinkActionBase.Target="fileBarSubItem" dxb:BarItemLinkActionBase.ItemLinkIndex="1" Content="Open" /> <dxb:BarButtonItem x:Name="saveBarButtonItem" dxb:BarItemLinkActionBase.Target="fileBarSubItem" dxb:BarItemLinkActionBase.ItemLinkIndex="2" Content="Save" /> <dxb:BarButtonItem x:Name="exitBarButtonItem" dxb:BarItemLinkActionBase.Target="fileBarSubItem" dxb:BarItemLinkActionBase.ItemLinkIndex="3" Content="Exit" /> <dxb:BarSubItem x:Name="helpBarSubItem" dxb:BarItemLinkActionBase.TargetType="mainMenu" Content="Help" /> <dxb:BarButtonItem x:Name="aboutBarButtonItem" dxb:BarItemLinkActionBase.Target="helpBarSubItem" Content="About" /> </dxb:BarManagerActionContainer> </DataTemplate> <DataTemplate x:Key="DataTemplateKey2"> <dxb:BarManagerActionContainer> <dxb:RemoveBarItemAndLinkAction ItemName="helpBarSubItem" /> <dxb:RemoveBarItemAndLinkAction ItemName="exitBarButtonItem" /> </dxb:BarManagerActionContainer> </DataTemplate> </Window.Resources> <Grid> <dxb:BarManager CreateStandardLayout="True"> <dxb:BarManager.Controllers> <dxb:TemplatedBarManagerController ExecuteBefore="True" Template="{StaticResource DataTemplateKey1}" /> <dxb:TemplatedBarManagerController ExecuteBefore="False" Template="{StaticResource DataTemplateKey2}" /> </dxb:BarManager.Controllers> <dxb:BarManager.Items> <dxb:BarCheckItem x:Name="boldBarCheckItem" Content="Bold" /> <dxb:BarCheckItem x:Name="italicBarCheckItem" Content="Italic" /> <dxb:BarCheckItem x:Name="underlineBarCheckItem" Content="Underline" /> </dxb:BarManager.Items> <dxb:BarManager.Bars> <dxb:Bar x:Name="formatBar" Caption="Format Bar"> <dxb:Bar.DockInfo> <dxb:BarDockInfo ContainerType="Top" Row="1" /> </dxb:Bar.DockInfo> <dxb:Bar.ItemLinks> <dxb:BarCheckItemLink BarItemName="boldBarCheckItem" /> <dxb:BarCheckItemLink BarItemName="italicBarCheckItem" /> <dxb:BarCheckItemLink BarItemName="underlineBarCheckItem" /> </dxb:Bar.ItemLinks> </dxb:Bar> </dxb:BarManager.Bars> <RichTextBox /> </dxb:BarManager> </Grid> |
※ xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"