/
MainWindow.xaml
73 lines (71 loc) · 3.93 KB
/
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
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
<Window
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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
x:Class="WpfApplication20.MainWindow"
Title="MainWindow" Height="275" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxb:MainMenuControl Grid.Row="0">
<dxb:BarButtonItem Content="File"/>
<dxb:BarButtonItem Content="Settings"/>
<dxb:BarButtonItem Content="Exit"/>
</dxb:MainMenuControl>
<TabControl Grid.Row="1">
<TabControl.Resources>
<ControlTemplate x:Key="menuPresenterTemplate" TargetType="ContentControl">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--The following MainMenuControl belongs to the name scope implicitly defined for the Window.
The Window's name scope is topmost.-->
<dxb:MainMenuControl Grid.Row="0" x:Name="elementHost"/>
<ContentPresenter Grid.Row="1"/>
</Grid>
</ControlTemplate>
</TabControl.Resources>
<!--Specify the InternalWithInternal merging behavior: a Tab's elements are only merged with other elements of the same Tab
provided that they are defined in parent name scopes
-->
<TabItem Header="Tab 1" dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal">
<ContentControl Template="{StaticResource menuPresenterTemplate}">
<StackPanel>
<!--control 1-->
<!--Explicitly define a name scope for the StackPanel.-->
<!--Elements of this container will be merged to the 'elementHost' MainMenuControl, as it is defined in the parent name scope-->
<StackPanel dxb:BarNameScope.IsScopeOwner="True">
<dxb:MainMenuControl>
<dxb:BarButtonItem Content="Cut"/>
<dxb:BarButtonItem Content="Copy"/>
<dxb:BarButtonItem Content="Paste"/>
</dxb:MainMenuControl>
<TextBox Text="Text 1"/>
</StackPanel>
<!--control 2-->
<!--Explicitly define a name scope for the StackPanel.-->
<!--Elements of this container will be merged to the 'elementHost' MainMenuControl, as it is defined in the parent name scope-->
<StackPanel dxb:BarNameScope.IsScopeOwner="True">
<dxb:MainMenuControl>
<dxb:BarButtonItem Content="Left"/>
<dxb:BarButtonItem Content="Center"/>
<dxb:BarButtonItem Content="Right"/>
</dxb:MainMenuControl>
<TextBox Text="Text 2"/>
</StackPanel>
</StackPanel>
</ContentControl>
</TabItem>
<TabItem Header="Tab 2" dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal">
<ContentControl Template="{StaticResource menuPresenterTemplate}">
<!--...-->
</ContentControl>
</TabItem>
</TabControl>
</Grid>
</Window>