358 lines
20 KiB
XML
358 lines
20 KiB
XML
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="using:Toolkit.UI.Controls.Avalonia"
|
|
xmlns:ui="using:FluentAvalonia.UI.Controls">
|
|
<Design.PreviewWith>
|
|
<Border Padding="20" />
|
|
</Design.PreviewWith>
|
|
<ControlTheme x:Key="{x:Type ui:ContentDialog}" TargetType="ui:ContentDialog">
|
|
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
|
|
<Setter Property="Background" Value="{DynamicResource ContentDialogBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ContentDialogBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{DynamicResource ContentDialogBorderWidth}" />
|
|
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Name="Container">
|
|
<Panel Name="LayoutRoot" Background="{DynamicResource ContentDialogSmokeFill}">
|
|
<controls:BlurBehind />
|
|
<ui:FABorder
|
|
Name="BackgroundElement"
|
|
MinWidth="{DynamicResource ContentDialogMinWidth}"
|
|
MinHeight="{DynamicResource ContentDialogMinHeight}"
|
|
MaxWidth="{DynamicResource ContentDialogMaxWidth}"
|
|
MaxHeight="{DynamicResource ContentDialogMaxHeight}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{StaticResource ContentDialogBorderWidth}"
|
|
BoxShadow="0 8 32 0 #66000000"
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
<!-- Even in WinUI, shadow is always black regardless of light/dark mode -->
|
|
|
|
<!--
|
|
if this border isn't here, dialog space displays outside of corner radius at top
|
|
if we put ClipToBounds=True on BackgroundElement above, it clips the shadow
|
|
-->
|
|
<Border ClipToBounds="True" CornerRadius="{TemplateBinding CornerRadius}">
|
|
<Grid
|
|
Name="DialogSpace"
|
|
ClipToBounds="True"
|
|
RowDefinitions="*,Auto">
|
|
<ScrollViewer
|
|
Name="ContentScrollViewer"
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto">
|
|
<Border
|
|
Padding="{DynamicResource ContentDialogPadding}"
|
|
Background="{DynamicResource ContentDialogTopOverlay}"
|
|
BorderBrush="{DynamicResource ContentDialogSeparatorBorderBrush}"
|
|
BorderThickness="{StaticResource ContentDialogSeparatorThickness}">
|
|
<Grid RowDefinitions="Auto,*">
|
|
<Grid.Styles>
|
|
<!-- Make sure text wrapping is on -->
|
|
<Style Selector="TextBlock">
|
|
<Setter Property="TextWrapping" Value="Wrap" />
|
|
</Style>
|
|
</Grid.Styles>
|
|
<ContentControl
|
|
Name="Title"
|
|
Margin="{StaticResource ContentDialogTitleMargin}"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Top"
|
|
Content="{TemplateBinding Title}"
|
|
ContentTemplate="{TemplateBinding TitleTemplate}"
|
|
FontFamily="Default"
|
|
FontSize="20"
|
|
FontWeight="SemiBold"
|
|
Foreground="{TemplateBinding Foreground}">
|
|
<ContentControl.Template>
|
|
<ControlTemplate>
|
|
<ContentPresenter
|
|
Margin="{TemplateBinding Padding}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
|
</ControlTemplate>
|
|
</ContentControl.Template>
|
|
</ContentControl>
|
|
|
|
<ContentPresenter
|
|
Name="Content"
|
|
Grid.Row="1"
|
|
Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
FontFamily="{StaticResource ContentControlThemeFontFamily}"
|
|
FontSize="{StaticResource ControlContentThemeFontSize}"
|
|
Foreground="{TemplateBinding Foreground}" />
|
|
</Grid>
|
|
</Border>
|
|
</ScrollViewer>
|
|
|
|
<Border
|
|
Grid.Row="1"
|
|
Padding="{StaticResource ContentDialogPadding}"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Bottom"
|
|
Background="{TemplateBinding Background}">
|
|
<Grid Name="CommandSpace">
|
|
<!--
|
|
B/C we can't target Row/Column defs in Styles like WinUI
|
|
this still uses the old Col defs, but it works the same
|
|
way in the end...
|
|
-->
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="0.5*" />
|
|
<ColumnDefinition Width="0.5*" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Button
|
|
Name="PrimaryButton"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Content="{TemplateBinding PrimaryButtonText}"
|
|
IsEnabled="{TemplateBinding IsPrimaryButtonEnabled}"
|
|
IsVisible="False" />
|
|
|
|
<Button
|
|
Name="SecondaryButton"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Content="{TemplateBinding SecondaryButtonText}"
|
|
IsEnabled="{TemplateBinding IsSecondaryButtonEnabled}"
|
|
IsVisible="False" />
|
|
|
|
<Button
|
|
Name="CloseButton"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Content="{TemplateBinding CloseButtonText}"
|
|
IsVisible="False" />
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
</ui:FABorder>
|
|
</Panel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<!-- Handle hidden dialog -->
|
|
<Style Selector="^:hidden /template/ Panel#LayoutRoot">
|
|
<Style.Animations>
|
|
<Animation FillMode="Forward" Duration="00:00:00.167">
|
|
<KeyFrame Cue="0%">
|
|
<Setter Property="Opacity" Value="1.0" />
|
|
</KeyFrame>
|
|
<KeyFrame Cue="100%">
|
|
<Setter Property="Opacity" Value="0.0" />
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</KeyFrame>
|
|
</Animation>
|
|
</Style.Animations>
|
|
</Style>
|
|
<Style Selector="^:hidden /template/ Border#Container">
|
|
<Style.Animations>
|
|
<Animation FillMode="Forward" Duration="00:00:00.167">
|
|
<KeyFrame Cue="0%">
|
|
<Setter Property="ScaleTransform.ScaleX" Value="1.0" />
|
|
<Setter Property="ScaleTransform.ScaleY" Value="1.0" />
|
|
</KeyFrame>
|
|
<KeyFrame Cue="100%" KeySpline="0,0 0,1">
|
|
<Setter Property="ScaleTransform.ScaleX" Value="1.05" />
|
|
<Setter Property="ScaleTransform.ScaleY" Value="1.05" />
|
|
</KeyFrame>
|
|
</Animation>
|
|
</Style.Animations>
|
|
</Style>
|
|
|
|
<!-- Handle open dialog -->
|
|
<Style Selector="^:open /template/ Panel#LayoutRoot">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Style.Animations>
|
|
<!--
|
|
Animation applies with priority of LocalValue
|
|
To overrule the IsVisible=False in :hidden, set
|
|
IsVisible=True in BOTH KeyFrames here
|
|
-->
|
|
<Animation FillMode="Forward" Duration="00:00:00.250">
|
|
<KeyFrame Cue="0%">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Opacity" Value="0.0" />
|
|
</KeyFrame>
|
|
<KeyFrame Cue="100%">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Opacity" Value="1.0" />
|
|
</KeyFrame>
|
|
</Animation>
|
|
</Style.Animations>
|
|
</Style>
|
|
<Style Selector="^:open /template/ Border#Container">
|
|
<Style.Animations>
|
|
<Animation FillMode="Forward" Duration="00:00:00.250">
|
|
<KeyFrame Cue="0%">
|
|
<Setter Property="ScaleTransform.ScaleX" Value="1.05" />
|
|
<Setter Property="ScaleTransform.ScaleY" Value="1.05" />
|
|
</KeyFrame>
|
|
<KeyFrame Cue="100%" KeySpline="0,0 0,1">
|
|
<Setter Property="ScaleTransform.ScaleX" Value="1.00" />
|
|
<Setter Property="ScaleTransform.ScaleY" Value="1.00" />
|
|
</KeyFrame>
|
|
</Animation>
|
|
</Style.Animations>
|
|
</Style>
|
|
|
|
<!-- Handle showing smoke layer -->
|
|
<Style Selector="^:nosmokelayer /template/ Panel#LayoutRoot">
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
</Style>
|
|
|
|
<!-- Handle FullDialogSizing -->
|
|
<Style Selector="^:fullsize /template/ ui|FABorder#BackgroundElement">
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
</Style>
|
|
|
|
|
|
<!-- Primary Button Only -->
|
|
<Style Selector="^:primary /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
</Style>
|
|
<Style Selector="^:primary /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:primary /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
|
|
<!-- Secondary Button Only -->
|
|
<Style Selector="^:secondary /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:secondary /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
</Style>
|
|
<Style Selector="^:secondary /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
|
|
<!-- Close Button Only -->
|
|
<Style Selector="^:close /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:close /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:close /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
</Style>
|
|
|
|
<!-- Margins are defined by ContentDialogButtonSpacing (8) -->
|
|
|
|
<!-- Primary and Secondary -->
|
|
<Style Selector="^:primary:secondary /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="0 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="4 0 0 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
|
|
<!-- Primary and Close Buttons -->
|
|
<Style Selector="^:primary:close /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="0 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:close /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:primary:close /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="4 0 0 0" />
|
|
</Style>
|
|
|
|
<!-- Primary and Secondary Buttons -->
|
|
<Style Selector="^:primary:secondary /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="0 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="4 0 0 0" />
|
|
</Style>
|
|
|
|
<!-- Secondary and Close Buttons -->
|
|
<Style Selector="^:secondary:close /template/ Button#Secondary">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="0 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:secondary:close /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="False" />
|
|
</Style>
|
|
<Style Selector="^:secondary:close /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="4 0 0 0" />
|
|
</Style>
|
|
|
|
|
|
<!-- All Buttons -->
|
|
<Style Selector="^:primary:secondary:close /template/ Button#PrimaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.ColumnSpan" Value="1" />
|
|
<Setter Property="Margin" Value="0 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary:close /template/ Button#SecondaryButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="1" />
|
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
|
<Setter Property="Margin" Value="4 0 4 0" />
|
|
</Style>
|
|
<Style Selector="^:primary:secondary:close /template/ Button#CloseButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
<Setter Property="Grid.Column" Value="3" />
|
|
<Setter Property="Grid.ColumnSpan" Value="1" />
|
|
<Setter Property="Margin" Value="4 0 0 0" />
|
|
</Style>
|
|
</ControlTheme>
|
|
</ResourceDictionary>
|