Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Fix for #62 - window unmovable
Browse files Browse the repository at this point in the history
  • Loading branch information
COM8 committed Apr 22, 2019
1 parent 1a1e02f commit 9d7d664
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
1 change: 1 addition & 0 deletions UWPX_UI/Controls/CustomSettingsTitleBarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<Grid x:Name="titleBar_grid"
Grid.Row="0"
VerticalAlignment="Stretch"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="leftPaddingColumn"
Expand Down
4 changes: 3 additions & 1 deletion UWPX_UI/Controls/CustomSettingsTitleBarControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ private void UpdateTitleBarLayout(CoreApplicationViewTitleBar titleBar)
titleBar_grid.Margin = new Thickness(0, -1, 0, 0);

// Update title bar control size as needed to account for system size changes.
titleBar_grid.Height = titleBar.Height;
// Do not update the Height since it will be always 0 - bug
// Reference: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/15657012-titlebar-extendviewintotitlebar-in-anniv-update-b
// titleBar_grid.Height = titleBar.Height;
}

private void SetupKeyboardAccelerators()
Expand Down
52 changes: 26 additions & 26 deletions UWPX_UI/Controls/CustomTitleBarControl.xaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<UserControl
x:Class="UWPX_UI.Controls.CustomTitleBarControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:UWPX_UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource AppBackgroundAcrylicElementBrush}"
mc:Ignorable="d">
<UserControl x:Class="UWPX_UI.Controls.CustomTitleBarControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:UWPX_UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource AppBackgroundAcrylicElementBrush}"
mc:Ignorable="d">

<Grid Background="{x:Bind Background, Mode=OneWay}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid
x:Name="titleBar_grid"
Grid.Row="0"
Background="Transparent">
<Grid x:Name="titleBar_grid"
Grid.Row="0"
VerticalAlignment="Stretch"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="leftPaddingColumn" Width="0" />
<ColumnDefinition />
<ColumnDefinition x:Name="rightPaddingColumn" Width="0" />
<ColumnDefinition x:Name="leftPaddingColumn"
Width="0"/>
<ColumnDefinition/>
<ColumnDefinition x:Name="rightPaddingColumn"
Width="0"/>
</Grid.ColumnDefinitions>
</Grid>
<Button
x:Name="backRequest_btn"
Grid.Row="0"
HorizontalAlignment="Left"
Click="BackRequest_btn_Click"
Style="{ThemeResource NavigationBackButtonSmallStyle}"
Visibility="{x:Bind BackRequestButtonVisibility, Mode=OneWay}" />
<controls:SeperatorControl Grid.Row="1" />
<Button x:Name="backRequest_btn"
Grid.Row="0"
HorizontalAlignment="Left"
Click="BackRequest_btn_Click"
Style="{ThemeResource NavigationBackButtonSmallStyle}"
Visibility="{x:Bind BackRequestButtonVisibility, Mode=OneWay}"/>
<controls:SeperatorControl Grid.Row="1"/>
</Grid>
</UserControl>
5 changes: 4 additions & 1 deletion UWPX_UI/Controls/CustomTitleBarControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private void UpdateTitleBarLayout()
// Set XAML element as a draggable region.
CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar;
UpdateTitleBarLayout(titleBar);

Window.Current.SetTitleBar(titleBar_grid);
titleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged;
}
Expand All @@ -127,7 +128,9 @@ private void UpdateTitleBarLayout(CoreApplicationViewTitleBar titleBar)
titleBar_grid.Margin = new Thickness(0, -1, 0, 0);

// Update title bar control size as needed to account for system size changes.
titleBar_grid.Height = titleBar.Height;
// Do not update the Height since it will be always 0 - bug
// Reference: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/15657012-titlebar-extendviewintotitlebar-in-anniv-update-b
// titleBar_grid.Height = titleBar.Height;
}

private void SetupKeyboardAccelerators()
Expand Down

0 comments on commit 9d7d664

Please sign in to comment.