feat: make titlebar visible property actually useful.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<!-- Add Resources Here -->
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme x:Key="{x:Type u:UrsaView}" TargetType="{x:Type u:UrsaView}">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
|
||||
@@ -20,12 +21,25 @@
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<Grid ColumnDefinitions="Auto, *, Auto"
|
||||
<Grid
|
||||
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}">
|
||||
<ContentPresenter Grid.Column="0" Content="{TemplateBinding LeftContent}" VerticalAlignment="Center"/>
|
||||
<ContentPresenter Grid.Column="1" Content="{TemplateBinding TitleBarContent}" VerticalAlignment="Center"/>
|
||||
<ContentPresenter Grid.Column="2" Content="{TemplateBinding RightContent}" VerticalAlignment="Center"/>
|
||||
ColumnDefinitions="Auto, *, Auto">
|
||||
<ContentPresenter
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleBarVisible}"
|
||||
Content="{TemplateBinding LeftContent}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleBarVisible}"
|
||||
Content="{TemplateBinding TitleBarContent}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleBarVisible}"
|
||||
Content="{TemplateBinding RightContent}" />
|
||||
</Grid>
|
||||
<u:OverlayDialogHost IsModalStatusReporter="True" />
|
||||
</Panel>
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<VisualLayerManager Padding="{TemplateBinding OffScreenMargin, Mode=OneWay}">
|
||||
<VisualLayerManager.ChromeOverlayLayer>
|
||||
<u:TitleBar
|
||||
IsTitleVisible="{TemplateBinding IsTitleBarVisible}"
|
||||
Content="{Binding $parent[u:UrsaWindow].TitleBarContent}"
|
||||
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
|
||||
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
|
||||
@@ -97,14 +98,17 @@
|
||||
<ContentPresenter
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}"
|
||||
Content="{TemplateBinding LeftContent}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}"
|
||||
Content="{TemplateBinding Content}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}"
|
||||
Content="{TemplateBinding RightContent}" />
|
||||
<u:CaptionButtons
|
||||
x:Name="PART_CaptionButtons"
|
||||
|
||||
@@ -29,6 +29,15 @@ public class TitleBar: ContentControl
|
||||
get => GetValue(RightContentProperty);
|
||||
set => SetValue(RightContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsTitleVisibleProperty = AvaloniaProperty.Register<TitleBar, bool>(
|
||||
nameof(IsTitleVisible));
|
||||
|
||||
public bool IsTitleVisible
|
||||
{
|
||||
get => GetValue(IsTitleVisibleProperty);
|
||||
set => SetValue(IsTitleVisibleProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ public class UrsaWindow: Window
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsTitleBarVisibleProperty = AvaloniaProperty.Register<UrsaWindow, bool>(
|
||||
nameof(IsTitleBarVisible));
|
||||
nameof(IsTitleBarVisible), true);
|
||||
|
||||
public bool IsTitleBarVisible
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user