-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMainWindow.xaml
108 lines (100 loc) · 5.56 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
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
<mah:MetroWindow x:Class="Power_Control_Panel.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:viewModels="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes.ViewModels"
xmlns:navigation="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes.Navigation"
xmlns:classes="clr-namespace:Power_Control_Panel.PowerControlPanel.Classes"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
Title="Power Control Panel" Height="650" Width="1000" Closing="MetroWindow_Closing" MinWidth="650" MinHeight="350" StateChanged="MetroWindow_StateChanged" Loaded="MetroWindow_Loaded" WindowState="Minimized">
<controls:MetroWindow.DataContext>
<viewModels:ShellViewModel />
</controls:MetroWindow.DataContext>
<controls:MetroWindow.LeftWindowCommands>
<controls:WindowCommands ShowSeparators="False">
<Button x:Name="GoBackButton"
Width="{Binding ElementName=HamburgerMenuControl, Path=CompactPaneLength}"
AutomationProperties.Name="Go back"
Click="GoBack_OnClick">
<controls:FontIcon AutomationProperties.Name="Go back icon"
FontSize="14"
Glyph="" />
</Button>
</controls:WindowCommands>
</controls:MetroWindow.LeftWindowCommands>
<controls:MetroWindow.Resources>
<DataTemplate x:Key="MenuItemTemplate" DataType="{x:Type viewModels:MenuItem}">
<Grid Height="48">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:HamburgerMenu}}, Path=CompactPaneLength, Mode=OneWay}" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ContentControl Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{Binding Icon}"
Focusable="False" />
<TextBlock Grid.Column="1"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding Label}" />
</Grid>
</DataTemplate>
<Storyboard x:Key="NavigationStoryboard">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00"
Value="0" />
<SplineDoubleKeyFrame KeyTime="00:00:00.150"
Value="1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:00"
Value="200" />
<SplineDoubleKeyFrame KeySpline="0.1, 0.9, 0.2, 1"
KeyTime="00:00:00.300"
Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style BasedOn="{StaticResource {x:Type Frame}}"
TargetType="{x:Type Frame}">
<Setter Property="navigation:FrameAnimator.FrameNavigationStoryboard"
Value="{StaticResource NavigationStoryboard}" />
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform />
</Setter.Value>
</Setter>
<Setter Property="Background"
Value="{DynamicResource MahApps.Brushes.Accent4}" />
<Setter Property="ClipToBounds"
Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Frame}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="PART_FrameCP">
<ContentPresenter.RenderTransform>
<TranslateTransform />
</ContentPresenter.RenderTransform>
</ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</controls:MetroWindow.Resources>
<controls:HamburgerMenu x:Name="HamburgerMenuControl"
DisplayMode="CompactInline"
IsPaneOpen="False"
ItemInvoked="HamburgerMenuControl_OnItemInvoked"
ItemTemplate="{StaticResource MenuItemTemplate}"
ItemsSource="{Binding Menu}"
OptionsItemTemplate="{StaticResource MenuItemTemplate}"
OptionsItemsSource="{Binding OptionsMenu}" />
</mah:MetroWindow>