forked from sachabruttin/FluentRibbonTest
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMetroWindow.xaml
118 lines (99 loc) · 5.74 KB
/
MetroWindow.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<mah:MetroWindow x:Class="FluentRibbonTest.MetroWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Fluent="urn:fluent-ribbon"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:fluentribbontest="clr-namespace:FluentRibbonTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
Title="My first RibbonWindow"
GlowBrush="{DynamicResource MahApps.Brushes.Accent}"
ShowIconOnTitleBar="False"
ShowSystemMenuOnRightClick="False"
ShowTitleBar="True"
TitleCharacterCasing="Normal"
WindowStartupLocation="CenterScreen"
WindowState="Normal"
WindowTransitionsEnabled="False"
Width="800"
Height="600">
<mah:MetroWindow.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
<Style x:Key="{x:Type Fluent:BackstageTabControl}"
BasedOn="{StaticResource {x:Type Fluent:BackstageTabControl}}"
TargetType="{x:Type Fluent:BackstageTabControl}">
<Setter Property="SelectedContentMargin" Value="0" />
</Style>
</mah:MetroWindow.Resources>
<mah:MetroWindow.TitleTemplate>
<DataTemplate>
<Fluent:RibbonTitleBar x:Name="RibbonTitleBar"
DataContext="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext}"
Header="{Binding Path=Title, RelativeSource={RelativeSource AncestorType=Window}}"/>
</DataTemplate>
</mah:MetroWindow.TitleTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Fluent:Ribbon Grid.Row="0" x:Name="ribbon"
AutomaticStateManagement="True"
IsSimplified="False"
CanUseSimplified="True">
<!--Backstage-->
<Fluent:Ribbon.Menu>
<Fluent:Backstage UseHighestAvailableAdornerLayer="False">
<Fluent:BackstageTabControl x:Name="backstageTabControl" SelectedContentMargin="0">
<Fluent:Button Header="Demo" />
</Fluent:BackstageTabControl>
</Fluent:Backstage>
</Fluent:Ribbon.Menu>
<!--Contextual Tab Groups-->
<Fluent:Ribbon.ContextualGroups>
<Fluent:RibbonContextualTabGroup x:Name="toolsGroup"
Header="Binding"
Background="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}"
BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}"
Foreground="{DynamicResource BlackBrush}"
TabItemMouseOverForeground="Red"
TabItemSelectedForeground="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Foreground}"
TabItemSelectedMouseOverForeground="OrangeRed"
Visibility="{Binding IsTabGroupVisible, Converter={StaticResource boolToVisibilityConverter}}"/>
<Fluent:RibbonContextualTabGroup x:Name="visibleGroup"
Header="No Binding"
Visibility="Visible"
Background="Green" BorderBrush="Green"
Foreground="Black"/>
</Fluent:Ribbon.ContextualGroups>
<!--Tabs-->
<Fluent:RibbonTabItem Header="Home">
<Fluent:RibbonGroupBox Header="Group">
<Fluent:Button Header="Show/Hide Tab"
LargeIcon="{StaticResource DocumentIcon}"
Command="{Binding ShowHideTab}"/>
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
<!--Contextual Tabs-->
<Fluent:RibbonTabItem Header="Contextual Group"
BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}"
ActiveTabBackground="Red"
Group="{Binding ElementName=toolsGroup, Mode=OneWay}"
Visibility="Visible">
<Fluent:RibbonGroupBox Header="Box 1">
<Fluent:ComboBox Header="Check Me" />
</Fluent:RibbonGroupBox>
<Fluent:RibbonGroupBox Header="Box 2">
<Fluent:ComboBox Header="Check Me Too" />
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
<Fluent:RibbonTabItem Header="Contextual Group"
Visibility="Visible"
Group="{Binding ElementName=visibleGroup, Mode=OneWay}">
</Fluent:RibbonTabItem>
</Fluent:Ribbon>
<TextBlock Text="Is visible!" Grid.Row="1"
Visibility="{Binding IsTabGroupVisible, Converter={StaticResource boolToVisibilityConverter}}"
/>
</Grid>
</mah:MetroWindow>