Skip to content

Commit 00d77f2

Browse files
niels9001michael-hawker
authored andcommitted
Adding overridable MinWidth for TitleBarContent
1 parent fa0c559 commit 00d77f2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

components/TitleBar/samples/SamplePages/ShellPage.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Page x:Class="TitleBarExperiment.Samples.ShellPage"
1+
<Page x:Class="TitleBarExperiment.Samples.ShellPage"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
@@ -23,6 +23,10 @@
2323
IsPaneButtonVisible="True"
2424
PaneButtonClick="appTitleBar_PaneButtonClick"
2525
Subtitle="Preview">
26+
<controls:TitleBar.Resources>
27+
<!-- Example of overriding the MinWidth of the SearchBox so it's extra wide -->
28+
<x:Double x:Key="TitleBarContentMinWidth">600</x:Double>
29+
</controls:TitleBar.Resources>
2630
<controls:TitleBar.Icon>
2731
<BitmapIcon ShowAsMonochrome="False"
2832
UriSource="ms-appx:///Assets/AppTitleBarIcon.png" />

components/TitleBar/src/TitleBar.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<x:Double x:Key="TitleBarCompactHeight">32</x:Double>
99
<x:Double x:Key="TitleBarTallHeight">48</x:Double>
10-
<x:Double x:Key="TitleBarContentMaxWidth">360</x:Double>
10+
<x:Double x:Key="TitleBarContentMinWidth">360</x:Double>
1111
<Style BasedOn="{StaticResource DefaultTitleBarStyle}"
1212
TargetType="local:TitleBar" />
1313

@@ -178,7 +178,7 @@
178178

179179
<ContentPresenter x:Name="PART_ContentPresenter"
180180
Grid.Column="5"
181-
MinWidth="360"
181+
MinWidth="{ThemeResource TitleBarContentMinWidth}"
182182
HorizontalAlignment="Stretch"
183183
VerticalAlignment="Center"
184184
HorizontalContentAlignment="Stretch"

0 commit comments

Comments
 (0)