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