Skip to content

Commit

Permalink
Extract custom title bar from MainWindow to separate user control. Us…
Browse files Browse the repository at this point in the history
…e the control in ConfigWindow and WizardWindow
  • Loading branch information
dominikgolda committed May 27, 2019
1 parent b640c6f commit 3aed2dc
Show file tree
Hide file tree
Showing 7 changed files with 355 additions and 114 deletions.
11 changes: 8 additions & 3 deletions src/Soloplan.WhatsON.GUI/Config/View/ConfigWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Soloplan.WhatsON.GUI.Config"
xmlns:gui="clr-namespace:Soloplan.WhatsON.GUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:properties="clr-namespace:Soloplan.WhatsON.GUI.Properties"
Expand All @@ -16,12 +16,17 @@
Closing="WindowClosing"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
ShowInTaskbar="False"
Style="{StaticResource BorderLessWindowStyle}"
TextElement.FontSize="14"
TextElement.FontWeight="Medium"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
mc:Ignorable="d">

<Grid>
<DockPanel Margin="0" LastChildFill="True">
<gui:CustomTitleBar CustomButtonVisible="False"
DockPanel.Dock="Top"
ShowMinimizeButton="False"
Window="{Binding RelativeSource={RelativeSource AncestorType={x:Type view:ConfigWindow}}}" />
<DockPanel Margin="5" LastChildFill="True">
<materialDesign:Snackbar x:Name="ConfigSnackBack"
Padding="8,8,30,8"
Expand Down Expand Up @@ -74,5 +79,5 @@
DockPanel.Dock="Right"
NavigationUIVisibility="Hidden" />
</DockPanel>
</Grid>
</DockPanel>
</Window>
105 changes: 57 additions & 48 deletions src/Soloplan.WhatsON.GUI/Config/Wizard/WizardWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,76 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Soloplan.WhatsON.GUI.Config.Wizard"
xmlns:gui="clr-namespace:Soloplan.WhatsON.GUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wizard="clr-namespace:Soloplan.WhatsON.GUI.Config.Wizard"
Title="Wizard"
Width="548.232"
Height="711.897"
MinHeight="400"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
ShowInTaskbar="False"
Style="{StaticResource BorderLessWindowStyle}"
TextElement.FontSize="14"
TextElement.FontWeight="Medium"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
mc:Ignorable="d">

<materialDesign:DialogHost Name="WizardWaitDialogHost" Identifier="WizardWaitDialogHostId">
<materialDesign:DialogHost.DialogContent>
<ProgressBar Width="50"
Height="50"
Margin="10"
IsIndeterminate="True"
Style="{StaticResource MaterialDesignCircularProgressBar}"
Value="0" />
</materialDesign:DialogHost.DialogContent>
<DockPanel Margin="0" LastChildFill="True">
<gui:CustomTitleBar CustomButtonVisible="False"
DockPanel.Dock="Top"
ShowMinimizeButton="False"
Window="{Binding RelativeSource={RelativeSource AncestorType={x:Type wizard:WizardWindow}}}" />

<DockPanel Margin="6" LastChildFill="True">
<TextBlock x:Name="StepDescription"
Margin="0,0,0,10"
VerticalAlignment="Top"
DockPanel.Dock="Top"
FontFamily="Arial"
FontSize="24"
FontWeight="SemiBold"
Text="Wizard step description"
TextWrapping="Wrap" />
<StackPanel Margin="0,15,0,6"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
<Button Width="90"
Margin="0,0,10,0"
Click="PrevClick"
IsEnabled="{Binding Path=IsNotFirstStep}">
Previous
</Button>
<Button Width="90"
Click="NextClick"
IsEnabled="{Binding Path=IsNextStepEnabled}"
Visibility="{Binding Path=IsNotLastStep, Converter={StaticResource BoolToVis}}">
Next
</Button>
<Button Width="90"
Click="FinishClick"
IsEnabled="{Binding Path=IsAnyProjectChecked}"
Visibility="{Binding Path=IsLastStep, Converter={StaticResource BoolToVis}}">
Finish
</Button>
</StackPanel>
<Frame x:Name="Frame"
Content="Frame"
NavigationUIVisibility="Hidden" />
</DockPanel>
</materialDesign:DialogHost>
<materialDesign:DialogHost Name="WizardWaitDialogHost" Identifier="WizardWaitDialogHostId">
<materialDesign:DialogHost.DialogContent>
<ProgressBar Width="50"
Height="50"
Margin="10"
IsIndeterminate="True"
Style="{StaticResource MaterialDesignCircularProgressBar}"
Value="0" />
</materialDesign:DialogHost.DialogContent>

<DockPanel Margin="6" LastChildFill="True">
<TextBlock x:Name="StepDescription"
Margin="0,0,0,10"
VerticalAlignment="Top"
DockPanel.Dock="Top"
FontFamily="Arial"
FontSize="24"
FontWeight="SemiBold"
Text="Wizard step description"
TextWrapping="Wrap" />
<StackPanel Margin="0,15,0,6"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
<Button Width="90"
Margin="0,0,10,0"
Click="PrevClick"
IsEnabled="{Binding Path=IsNotFirstStep}">
Previous
</Button>
<Button Width="90"
Click="NextClick"
IsEnabled="{Binding Path=IsNextStepEnabled}"
Visibility="{Binding Path=IsNotLastStep, Converter={StaticResource BoolToVis}}">
Next
</Button>
<Button Width="90"
Click="FinishClick"
IsEnabled="{Binding Path=IsAnyProjectChecked}"
Visibility="{Binding Path=IsLastStep, Converter={StaticResource BoolToVis}}">
Finish
</Button>
</StackPanel>
<Frame x:Name="Frame"
Content="Frame"
NavigationUIVisibility="Hidden" />
</DockPanel>
</materialDesign:DialogHost>
</DockPanel>
</Window>
67 changes: 67 additions & 0 deletions src/Soloplan.WhatsON.GUI/CustomTitleBar.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<UserControl x:Class="Soloplan.WhatsON.GUI.CustomTitleBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gui="clr-namespace:Soloplan.WhatsON.GUI"
d:DesignHeight="60"
d:DesignWidth="300"
mc:Ignorable="d">
<materialDesign:ColorZone Margin="0"
Padding="6"
materialDesign:ShadowAssist.ShadowDepth="Depth2"
DockPanel.Dock="Top"
Mode="PrimaryMid"
MouseDown="MainWindowBarMouseDown">
<DockPanel DockPanel.Dock="Top">

<materialDesign:PackIcon Width="30"
Height="30"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Cursor="Hand"
DockPanel.Dock="Left"
Kind="{Binding CustomButtonIcon}"
Visibility="{Binding CustomButtonVisible, Converter={StaticResource BoolToVis}}"
MouseDown="OnButtonClicked" />

<Button Width="30"
Height="30"
Margin="1"
Padding="0"
Click="CloseButtonClick"
Cursor="Hand"
DockPanel.Dock="Right"
IsTabStop="False">
<materialDesign:PackIcon Width="30"
Height="30"
Kind="WindowClose" />
</Button>

<Button x:Name="MinimizeButton"
Width="30"
Height="30"
Margin="1"
Padding="0,6,0,0"
Click="MinimizeButonClick"
Cursor="Hand"
DockPanel.Dock="Right"
IsTabStop="False"
Visibility="{Binding Path=ShowMinimizeButton, Converter={StaticResource BoolToVis}}">
<materialDesign:PackIcon Width="30"
Height="30"
Kind="WindowMinimize" />
</Button>

<TextBlock Name="appName"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DockPanel.Dock="Right"
FontSize="18"
Text="{Binding Path=Text}" />

</DockPanel>
</materialDesign:ColorZone>
</UserControl>
Loading

0 comments on commit 3aed2dc

Please sign in to comment.