feat: implement closing related features.

This commit is contained in:
rabbitism
2024-01-22 17:27:11 +08:00
parent 9cff01c032
commit 5c62131a0a
6 changed files with 70 additions and 20 deletions

View File

@@ -1,19 +1,35 @@
<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:DialogControl}" TargetType="u:DialogControl">
<Setter Property="Template">
<ControlTemplate TargetType="u:DialogControl">
<Border HorizontalAlignment="Center" VerticalAlignment="Center" Theme="{DynamicResource CardBorder}" Width="100" Height="100" IsHitTestVisible="True">
<Border
Classes="Shadow"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="True"
Theme="{DynamicResource CardBorder}">
<Grid RowDefinitions="Auto, *, Auto">
<ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter>
<StackPanel Grid.Row="0" HorizontalAlignment="Right">
<Button Name="{x:Static u:DialogControl.PART_CloseButton}">Close</Button>
</StackPanel>
<ContentPresenter
Grid.Row="0"
Grid.RowSpan="2"
Content="{TemplateBinding Content}" />
<StackPanel Grid.Row="2">
<Button>OK</Button>
<Button>Cancel</Button>
</StackPanel>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:DialogWindow}" TargetType="u:DialogWindow">
<Setter Property="Title" Value="{x:Null}" />
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
@@ -26,11 +42,15 @@
<Setter Property="WindowStartupLocation" Value="CenterOwner" />
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="1" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
<Setter Property="ExtendClientAreaChromeHints" Value="SystemChrome"/>
<Setter Property="ExtendClientAreaChromeHints" Value="SystemChrome" />
<Setter Property="SystemDecorations">
<OnPlatform >
<OnPlatform.Windows><SystemDecorations>Full</SystemDecorations></OnPlatform.Windows>
<OnPlatform.Default><SystemDecorations>BorderOnly</SystemDecorations></OnPlatform.Default>
<OnPlatform>
<OnPlatform.Windows>
<SystemDecorations>Full</SystemDecorations>
</OnPlatform.Windows>
<OnPlatform.Default>
<SystemDecorations>BorderOnly</SystemDecorations>
</OnPlatform.Default>
</OnPlatform>
</Setter>
<Setter Property="CanResize" Value="False" />
@@ -40,10 +60,10 @@
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
<Border Background="{TemplateBinding Background}" IsHitTestVisible="False" />
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
<ChromeOverlayLayer></ChromeOverlayLayer>
<ChromeOverlayLayer />
<Grid RowDefinitions="Auto, *, Auto">
<Button Name="{x:Static u:DialogWindow.PART_CloseButton}" VerticalAlignment="Top">Close</Button>
<ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter>
<ContentPresenter Content="{TemplateBinding Content}" />
</Grid>
</Panel>
</ControlTemplate>