feat: implement default control and window mode.

This commit is contained in:
rabbitism
2024-01-25 15:06:39 +08:00
parent 87bb47b4e1
commit 20f723b445
15 changed files with 331 additions and 88 deletions

View File

@@ -3,8 +3,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
Padding="24"
Background="Aqua"
x:Class="Ursa.Demo.Dialogs.PlainDialog"> x:Class="Ursa.Demo.Dialogs.PlainDialog">
<StackPanel> <StackPanel>
<Calendar SelectedDate="{Binding Date}" ></Calendar> <Calendar SelectedDate="{Binding Date}" ></Calendar>

View File

@@ -21,11 +21,11 @@
<Run Text="Date: "></Run> <Run Text="Date: "></Run>
<Run Text="{Binding DialogViewModel.Date}"></Run> <Run Text="{Binding DialogViewModel.Date}"></Run>
</TextBlock> </TextBlock>
<Button Command="{Binding ShowGlobalModalDialogCommand}">Show Modal Dialog</Button> <Button Command="{Binding ShowDefaultWindowCommand}">Show Default Modal Dialog</Button>
<Button Command="{Binding ShowGlobalModalDialogCommand}">Show Custom Modal Dialog</Button>
<Button Command="{Binding ShowLocalOverlayModalDialogCommand}">Show Local Overlay Modal Dialog</Button> <Button Command="{Binding ShowLocalOverlayModalDialogCommand}">Show Local Overlay Modal Dialog</Button>
<Button Command="{Binding ShowGlobalOverlayModalDialogCommand}"> Show Global Overlay Modal Dialog </Button> <Button Command="{Binding ShowGlobalOverlayModalDialogCommand}"> Show Global Overlay Modal Dialog </Button>
<Button Command="{Binding ShowGlobalOverlayDialogCommand}">Show Global Overlay Dialog</Button> <Button Command="{Binding ShowGlobalOverlayDialogCommand}">Show Global Overlay Dialog</Button>
<Button Command="{Binding ShowPlainGlobalOverlayDialogCommand}">Default Buttons</Button>
</StackPanel> </StackPanel>
<Grid Grid.Column="1"> <Grid Grid.Column="1">
<Button <Button

View File

@@ -16,7 +16,7 @@ public class DialogDemoViewModel: ObservableObject
public ICommand ShowGlobalOverlayModalDialogCommand { get; } public ICommand ShowGlobalOverlayModalDialogCommand { get; }
public ICommand ShowGlobalModalDialogCommand { get; } public ICommand ShowGlobalModalDialogCommand { get; }
public ICommand ShowGlobalOverlayDialogCommand { get; } public ICommand ShowGlobalOverlayDialogCommand { get; }
public ICommand ShowPlainGlobalOverlayDialogCommand { get; } public ICommand ShowDefaultWindowCommand { get; }
private object? _result; private object? _result;
public object? Result public object? Result
@@ -41,12 +41,20 @@ public class DialogDemoViewModel: ObservableObject
ShowGlobalOverlayModalDialogCommand = new AsyncRelayCommand(ShowGlobalOverlayModalDialog); ShowGlobalOverlayModalDialogCommand = new AsyncRelayCommand(ShowGlobalOverlayModalDialog);
ShowGlobalModalDialogCommand = new AsyncRelayCommand(ShowGlobalModalDialog); ShowGlobalModalDialogCommand = new AsyncRelayCommand(ShowGlobalModalDialog);
ShowGlobalOverlayDialogCommand = new RelayCommand(ShowGlobalOverlayDialog); ShowGlobalOverlayDialogCommand = new RelayCommand(ShowGlobalOverlayDialog);
ShowPlainGlobalOverlayDialogCommand = new AsyncRelayCommand(ShowPlainGlobalOverlayDialog); ShowDefaultWindowCommand = new AsyncRelayCommand(ShowDefaultWindow);
}
private async Task ShowDefaultWindow()
{
var result = await Dialog.ShowModalAsync<PlainDialog, PlainDialogViewModel>(new PlainDialogViewModel(),
mode: DialogMode.Error, buttons: DialogButton.OKCancel, title:"确定取消预约吗?");
Result = result;
return;
} }
private void ShowGlobalOverlayDialog() private void ShowGlobalOverlayDialog()
{ {
OverlayDialog.Show<DialogWithAction, DialogWithActionViewModel>(new DialogWithActionViewModel()); OverlayDialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(new DialogWithActionViewModel());
} }
private async Task ShowGlobalModalDialog() private async Task ShowGlobalModalDialog()
@@ -57,21 +65,15 @@ public class DialogDemoViewModel: ObservableObject
private async Task ShowGlobalOverlayModalDialog() private async Task ShowGlobalOverlayModalDialog()
{ {
Result = await OverlayDialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(DialogViewModel); Result = await OverlayDialog.ShowModalAsync<PlainDialog, PlainDialogViewModel>(new PlainDialogViewModel(),
title: "Please select a date", mode: DialogMode.Error, buttons: DialogButton.YesNoCancel);
} }
private async Task ShowLocalOverlayModalDialog() private async Task ShowLocalOverlayModalDialog()
{ {
var vm = new DialogWithActionViewModel(); var vm = new DialogWithActionViewModel();
var result = await OverlayDialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>( var result = await OverlayDialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(
DialogViewModel, "LocalHost"); vm, "LocalHost");
Result = result; Result = result;
} }
public async Task ShowPlainGlobalOverlayDialog()
{
var result = await OverlayDialog.ShowCustomModalAsync<PlainDialog, PlainDialogViewModel, object?>(
new PlainDialogViewModel(),
"LocalHost");
}
} }

View File

@@ -17,8 +17,8 @@ internal class ClassHelper: AvaloniaObject
private static void OnClassesChanged(StyledElement sender, AvaloniaPropertyChangedEventArgs value) private static void OnClassesChanged(StyledElement sender, AvaloniaPropertyChangedEventArgs value)
{ {
IEnumerable<string> classes = value.GetNewValue<IEnumerable<string>>(); string classes = value.GetNewValue<string>();
sender.Classes.Clear(); sender.Classes.Clear();
sender.Classes.AddRange(classes); sender.Classes.Add(classes);
} }
} }

View File

@@ -13,6 +13,7 @@
<ControlTemplate TargetType="u:DialogControl"> <ControlTemplate TargetType="u:DialogControl">
<Border <Border
Padding="0" Padding="0"
Margin="4"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Shadow" Classes="Shadow"
@@ -47,7 +48,7 @@
<Setter Property="ContextFlyout"> <Setter Property="ContextFlyout">
<MenuFlyout> <MenuFlyout>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.BringForward}" CommandParameter="{x:Static u:DialogLayerChangeType.BringForward}"
Header="Bring Forward"> Header="Bring Forward">
<MenuItem.Icon> <MenuItem.Icon>
@@ -58,7 +59,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.BringToFront}" CommandParameter="{x:Static u:DialogLayerChangeType.BringToFront}"
Header="Bring To Front"> Header="Bring To Front">
<MenuItem.Icon> <MenuItem.Icon>
@@ -69,7 +70,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.SendBackward}" CommandParameter="{x:Static u:DialogLayerChangeType.SendBackward}"
Header="Send Backward"> Header="Send Backward">
<MenuItem.Icon> <MenuItem.Icon>
@@ -80,7 +81,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.SendToBack}" CommandParameter="{x:Static u:DialogLayerChangeType.SendToBack}"
Header="Send To Back"> Header="Send To Back">
<MenuItem.Icon> <MenuItem.Icon>
@@ -94,6 +95,7 @@
</Setter> </Setter>
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="{x:Type u:DefaultDialogControl}" TargetType="u:DefaultDialogControl"> <ControlTheme x:Key="{x:Type u:DefaultDialogControl}" TargetType="u:DefaultDialogControl">
<Setter Property="CornerRadius" Value="12"></Setter> <Setter Property="CornerRadius" Value="12"></Setter>
<Setter Property="Template"> <Setter Property="Template">
@@ -107,10 +109,11 @@
ClipToBounds="True" ClipToBounds="True"
IsHitTestVisible="True" IsHitTestVisible="True"
Theme="{DynamicResource CardBorder}"> Theme="{DynamicResource CardBorder}">
<Grid Margin="24" RowDefinitions="Auto, *, Auto"> <Grid RowDefinitions="Auto, *, Auto">
<ContentPresenter <ContentPresenter
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
Grid.Row="1" Grid.Row="1"
Margin="24 8"
Content="{TemplateBinding Content}" /> Content="{TemplateBinding Content}" />
<Grid Grid.Row="0" ColumnDefinitions="Auto, *, Auto"> <Grid Grid.Row="0" ColumnDefinitions="Auto, *, Auto">
<Panel <Panel
@@ -121,27 +124,31 @@
<PathIcon <PathIcon
Name="PART_Icon" Name="PART_Icon"
Grid.Column="0" Grid.Column="0"
Margin="0 0 8 0" Margin="24 24 8 0"
Width="16" Width="16"
VerticalAlignment="Center"
Height="16" /> Height="16" />
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
Margin="8,8,0,0" Margin="0 24 0 0 "
Classes="Strong" FontWeight="Bold"
FontSize="16"
TextWrapping="Wrap" TextWrapping="Wrap"
VerticalAlignment="Center"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Title, IsVisible="{TemplateBinding Title,
Converter={x:Static ObjectConverters.IsNotNull}}" Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{TemplateBinding Title}" /> Text="{TemplateBinding Title}" />
<Button <Button
Name="{x:Static u:MessageBoxWindow.PART_CloseButton}" Name="{x:Static u:MessageBoxWindow.PART_CloseButton}"
Grid.Column="2" Grid.Column="2"
Margin="0,4,4,0" Margin="0 24 24 0"
DockPanel.Dock="Right" DockPanel.Dock="Right"
Theme="{DynamicResource CloseButton}" /> Theme="{DynamicResource CloseButton}" />
</Grid> </Grid>
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="2"
Margin="0,0,8,8" Margin="24 0 24 24"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Orientation="Horizontal"> Orientation="Horizontal">
<Button <Button
@@ -153,6 +160,7 @@
Name="{x:Static u:DefaultDialogControl.PART_NoButton}" Name="{x:Static u:DefaultDialogControl.PART_NoButton}"
Margin="8,0,0,0" Margin="8,0,0,0"
Classes="Danger" Classes="Danger"
Theme="{DynamicResource SolidButton}"
Content="否" /> Content="否" />
<Button <Button
Name="{x:Static u:DefaultDialogControl.PART_YesButton}" Name="{x:Static u:DefaultDialogControl.PART_YesButton}"
@@ -171,29 +179,127 @@
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^[Icon=None]"> <Style Selector="^[Mode=None]">
<Style Selector="^ /template/ PathIcon#PART_Icon"> <Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="False"></Setter> <Setter Property="IsVisible" Value="False"></Setter>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_OKButton"> <Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter> <Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style> </Style>
<Style Selector="^[Icon=Info]"> <Style Selector="^[Mode=Info]">
<Style Selector="^ /template/ PathIcon#PART_Icon"> <Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter> <Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogInformationIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}"></Setter> <Setter Property="Foreground" Value="{DynamicResource SemiBlue6}"></Setter>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_OKButton"> <Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter> <Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Warning]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogWarningIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Warning"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Warning"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Error]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogErrorIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiRed6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Question]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogQuestionIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Success]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogSuccessIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiGreen6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Success"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Success"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style> </Style>
<Style Selector="^:not(:modal) /template/ Panel#PART_TitleArea"> <Style Selector="^:not(:modal) /template/ Panel#PART_TitleArea">
<Setter Property="ContextFlyout"> <Setter Property="ContextFlyout">
<MenuFlyout> <MenuFlyout>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.BringForward}" CommandParameter="{x:Static u:DialogLayerChangeType.BringForward}"
Header="Bring Forward"> Header="Bring Forward">
<MenuItem.Icon> <MenuItem.Icon>
@@ -204,7 +310,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.BringToFront}" CommandParameter="{x:Static u:DialogLayerChangeType.BringToFront}"
Header="Bring To Front"> Header="Bring To Front">
<MenuItem.Icon> <MenuItem.Icon>
@@ -215,7 +321,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.SendBackward}" CommandParameter="{x:Static u:DialogLayerChangeType.SendBackward}"
Header="Send Backward"> Header="Send Backward">
<MenuItem.Icon> <MenuItem.Icon>
@@ -226,7 +332,7 @@
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
Command="{Binding $parent[u:DefaultDialogControl].UpdateLayer}" Command="{Binding $parent[u:DialogControl].UpdateLayer}"
CommandParameter="{x:Static u:DialogLayerChangeType.SendToBack}" CommandParameter="{x:Static u:DialogLayerChangeType.SendToBack}"
Header="Send To Back"> Header="Send To Back">
<MenuItem.Icon> <MenuItem.Icon>
@@ -331,53 +437,188 @@
<ChromeOverlayLayer /> <ChromeOverlayLayer />
<Grid RowDefinitions="Auto, *, Auto"> <Grid RowDefinitions="Auto, *, Auto">
<ContentPresenter <ContentPresenter
Grid.Row="0" Name="PART_ContentPresenter"
Grid.RowSpan="2" Grid.Row="1"
Margin="24 8"
Content="{TemplateBinding Content}" /> Content="{TemplateBinding Content}" />
<Grid Grid.Row="0" ColumnDefinitions="*, Auto"> <Grid Grid.Row="0" ColumnDefinitions="Auto, *, Auto">
<TextBlock <Panel
Name="{x:Static u:DialogControl.PART_TitleArea}"
Grid.Column="0" Grid.Column="0"
Margin="8,8,0,0" Grid.ColumnSpan="3"
FontSize="14" Background="Transparent" />
<PathIcon
Name="PART_Icon"
Grid.Column="0"
Margin="24 24 8 0"
Width="16"
VerticalAlignment="Center"
Height="16" />
<TextBlock
Grid.Column="1"
Margin="0 24 0 0 "
FontWeight="Bold" FontWeight="Bold"
Text="{TemplateBinding Title}" FontSize="16"
TextTrimming="CharacterEllipsis" TextWrapping="Wrap"
TextWrapping="NoWrap" /> VerticalAlignment="Center"
IsHitTestVisible="False"
IsVisible="{TemplateBinding Title,
Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{TemplateBinding Title}" />
<Button <Button
Name="{x:Static u:MessageBoxWindow.PART_CloseButton}" Name="{x:Static u:MessageBoxWindow.PART_CloseButton}"
Grid.Column="1" Grid.Column="2"
Margin="0,4,4,0" Margin="0 24 24 0"
DockPanel.Dock="Right"
Theme="{DynamicResource CloseButton}" /> Theme="{DynamicResource CloseButton}" />
</Grid> </Grid>
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="2"
Margin="0,0,8,8" Margin="24 0 24 24"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Orientation="Horizontal"> Orientation="Horizontal">
<Button <Button
Name="{x:Static u:DefaultDialogWindow.PART_CancelButton}" Name="{x:Static u:DefaultDialogControl.PART_CancelButton}"
Margin="8,0,0,0" Margin="8,0,0,0"
Classes="Tertiary" Classes="Tertiary"
Content="取消" /> Content="取消" />
<Button <Button
Name="{x:Static u:DefaultDialogWindow.PART_NoButton}" Name="{x:Static u:DefaultDialogControl.PART_NoButton}"
Margin="8,0,0,0" Margin="8,0,0,0"
Classes="Danger" Classes="Danger"
Theme="{DynamicResource SolidButton}"
Content="否" /> Content="否" />
<Button <Button
Name="{x:Static u:DefaultDialogWindow.PART_YesButton}" Name="{x:Static u:DefaultDialogControl.PART_YesButton}"
Margin="8,0,0,0" Margin="8,0,0,0"
Classes="Primary" Classes="Primary"
Theme="{DynamicResource SolidButton}"
Content="是" /> Content="是" />
<Button <Button
Name="{x:Static u:DefaultDialogWindow.PART_OKButton}" Name="{x:Static u:DefaultDialogControl.PART_OKButton}"
Margin="8,0,0,0" Margin="8,0,0,0"
Classes="Primary" Classes="Primary"
Theme="{DynamicResource SolidButton}"
Content="确认" /> Content="确认" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^[Mode=None]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="False"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Info]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogInformationIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Warning]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogWarningIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Warning"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Warning"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
<Setter Property="Theme" Value="{DynamicResource SolidButton}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Error]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogErrorIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiRed6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Question]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogQuestionIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Primary"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
<Style Selector="^[Mode=Success]">
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="Data" Value="{DynamicResource DialogSuccessIconGlyph}"></Setter>
<Setter Property="Foreground" Value="{DynamicResource SemiGreen6}"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="theme:ClassHelper.Classes" Value="Success"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="theme:ClassHelper.Classes" Value="Success"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="theme:ClassHelper.Classes" Value="Danger"></Setter>
</Style>
<Style Selector="^ /template/ Button#PART_CancelButton">
<Setter Property="theme:ClassHelper.Classes" Value="Tertiary"></Setter>
</Style>
</Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -107,32 +107,32 @@
<Style Selector="^[MessageIcon=Asterisk] /template/ PathIcon#PART_Icon, ^[MessageIcon=Information] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Asterisk] /template/ PathIcon#PART_Icon, ^[MessageIcon=Information] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiBlue6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowInformationIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogInformationIconGlyph}" />
</Style> </Style>
<Style Selector="^[MessageIcon=Error] /template/ PathIcon#PART_Icon, ^[MessageIcon=Hand] /template/ PathIcon#PART_Icon, ^[MessageIcon=Stop] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Error] /template/ PathIcon#PART_Icon, ^[MessageIcon=Hand] /template/ PathIcon#PART_Icon, ^[MessageIcon=Stop] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiRed6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiRed6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowErrorIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogErrorIconGlyph}" />
</Style> </Style>
<Style Selector="^[MessageIcon=Exclamation] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Exclamation] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiYellow6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiYellow6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowWarningIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogWarningIconGlyph}" />
</Style> </Style>
<Style Selector="^[MessageIcon=Question] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Question] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiBlue6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiBlue6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowQuestionIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogQuestionIconGlyph}" />
</Style> </Style>
<Style Selector="^[MessageIcon=Warning] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Warning] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiOrange6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowWarningIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogWarningIconGlyph}" />
</Style> </Style>
<Style Selector="^[MessageIcon=Success] /template/ PathIcon#PART_Icon"> <Style Selector="^[MessageIcon=Success] /template/ PathIcon#PART_Icon">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SemiGreen6}" /> <Setter Property="Foreground" Value="{DynamicResource SemiGreen6}" />
<Setter Property="Data" Value="{DynamicResource MessageBoxWindowSuccessIconGlyph}" /> <Setter Property="Data" Value="{DynamicResource DialogSuccessIconGlyph}" />
</Style> </Style>
</ControlTheme> </ControlTheme>

View File

@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StreamGeometry x:Key="DialogQuestionIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM11.8281 14.6094C10.9688 14.6094 10.5391 14.0723 10.5391 13.3691C10.5391 12.3242 11.0566 11.6504 12.2676 10.7324C12.2894 10.7158 12.3111 10.6993 12.3326 10.6829C13.1573 10.0555 13.7324 9.61807 13.7324 8.82812C13.7324 7.93945 12.9023 7.42188 11.9746 7.42188C11.2129 7.42188 10.627 7.70508 10.168 8.30078C9.83594 8.64258 9.57227 8.82812 9.12305 8.82812C8.38086 8.82812 8 8.31055 8 7.71484C8 7.10938 8.3418 6.49414 8.87891 6.02539C9.60156 5.40039 10.7539 5 12.2773 5C14.9922 5 16.8965 6.33789 16.8965 8.64258C16.8965 10.3223 15.8906 11.1328 14.709 11.9531C13.9082 12.5391 13.5273 12.8809 13.2246 13.5742L13.2238 13.5756C12.8922 14.1609 12.638 14.6094 11.8281 14.6094ZM11.8086 18.7695C10.8711 18.7695 10.0996 18.1641 10.0996 17.2266C10.0996 16.2891 10.8711 15.6836 11.8086 15.6836C12.7461 15.6836 13.5078 16.2891 13.5078 17.2266C13.5078 18.1641 12.7461 18.7695 11.8086 18.7695Z</StreamGeometry>
<StreamGeometry x:Key="DialogInformationIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</StreamGeometry>
<StreamGeometry x:Key="DialogWarningIconGlyph">M10.2268 2.3986L1.52616 19.0749C0.831449 20.4064 1.79747 22 3.29933 22H20.7007C22.2025 22 23.1686 20.4064 22.4739 19.0749L13.7732 2.3986C13.0254 0.965441 10.9746 0.965442 10.2268 2.3986ZM13.1415 14.0101C13.0603 14.5781 12.5739 15 12.0001 15C11.4263 15 10.9398 14.5781 10.8586 14.0101L10.2829 9.97992C10.1336 8.93495 10.9445 8.00002 12.0001 8.00002C13.0556 8.00002 13.8665 8.93495 13.7172 9.97992L13.1415 14.0101ZM13.5001 18.5C13.5001 19.3284 12.8285 20 12.0001 20C11.1716 20 10.5001 19.3284 10.5001 18.5C10.5001 17.6716 11.1716 17 12.0001 17C12.8285 17 13.5001 17.6716 13.5001 18.5Z</StreamGeometry>
<StreamGeometry x:Key="DialogErrorIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17.0352 16.8626C16.4597 17.4585 15.5101 17.4751 14.9142 16.8996L12.0368 14.121L9.25822 16.9984C8.68274 17.5943 7.73314 17.6109 7.13722 17.0354C6.5413 16.4599 6.52472 15.5103 7.1002 14.9144L9.87883 12.037L7.00147 9.2584C6.40555 8.68293 6.38897 7.73332 6.96445 7.1374C7.53992 6.54148 8.48953 6.52491 9.08545 7.10038L11.9628 9.87901L14.7414 7.00165C15.3169 6.40573 16.2665 6.38916 16.8624 6.96463C17.4584 7.54011 17.4749 8.48971 16.8995 9.08563L14.1208 11.963L16.9982 14.7416C17.5941 15.3171 17.6107 16.2667 17.0352 16.8626Z</StreamGeometry>
<StreamGeometry x:Key="DialogSuccessIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17.8831 9.82235L11.6854 17.4112C11.4029 17.7806 10.965 17.9981 10.5 18C10.035 18.0019 9.59533 17.788 9.30982 17.421L5.81604 13.4209C5.30744 12.767 5.42524 11.8246 6.07916 11.316C6.73308 10.8074 7.67549 10.9252 8.1841 11.5791L10.4838 14.0439L15.5 8C16.0032 7.34193 16.9446 7.21641 17.6027 7.71964C18.2608 8.22287 18.3863 9.16428 17.8831 9.82235Z</StreamGeometry>
</ResourceDictionary>

View File

@@ -0,0 +1,3 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="MessageBoxWindowContentMaxWidth">300</x:Double>
</ResourceDictionary>

View File

@@ -1,10 +0,0 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<StreamGeometry x:Key="MessageBoxWindowQuestionIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM11.8281 14.6094C10.9688 14.6094 10.5391 14.0723 10.5391 13.3691C10.5391 12.3242 11.0566 11.6504 12.2676 10.7324C12.2894 10.7158 12.3111 10.6993 12.3326 10.6829C13.1573 10.0555 13.7324 9.61807 13.7324 8.82812C13.7324 7.93945 12.9023 7.42188 11.9746 7.42188C11.2129 7.42188 10.627 7.70508 10.168 8.30078C9.83594 8.64258 9.57227 8.82812 9.12305 8.82812C8.38086 8.82812 8 8.31055 8 7.71484C8 7.10938 8.3418 6.49414 8.87891 6.02539C9.60156 5.40039 10.7539 5 12.2773 5C14.9922 5 16.8965 6.33789 16.8965 8.64258C16.8965 10.3223 15.8906 11.1328 14.709 11.9531C13.9082 12.5391 13.5273 12.8809 13.2246 13.5742L13.2238 13.5756C12.8922 14.1609 12.638 14.6094 11.8281 14.6094ZM11.8086 18.7695C10.8711 18.7695 10.0996 18.1641 10.0996 17.2266C10.0996 16.2891 10.8711 15.6836 11.8086 15.6836C12.7461 15.6836 13.5078 16.2891 13.5078 17.2266C13.5078 18.1641 12.7461 18.7695 11.8086 18.7695Z</StreamGeometry>
<StreamGeometry x:Key="MessageBoxWindowInformationIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM14 7C14 8.10457 13.1046 9 12 9C10.8954 9 10 8.10457 10 7C10 5.89543 10.8954 5 12 5C13.1046 5 14 5.89543 14 7ZM9 10.75C9 10.3358 9.33579 10 9.75 10H12.5C13.0523 10 13.5 10.4477 13.5 11V16.5H14.25C14.6642 16.5 15 16.8358 15 17.25C15 17.6642 14.6642 18 14.25 18H9.75C9.33579 18 9 17.6642 9 17.25C9 16.8358 9.33579 16.5 9.75 16.5H10.5V11.5H9.75C9.33579 11.5 9 11.1642 9 10.75Z</StreamGeometry>
<StreamGeometry x:Key="MessageBoxWindowWarningIconGlyph">M10.2268 2.3986L1.52616 19.0749C0.831449 20.4064 1.79747 22 3.29933 22H20.7007C22.2025 22 23.1686 20.4064 22.4739 19.0749L13.7732 2.3986C13.0254 0.965441 10.9746 0.965442 10.2268 2.3986ZM13.1415 14.0101C13.0603 14.5781 12.5739 15 12.0001 15C11.4263 15 10.9398 14.5781 10.8586 14.0101L10.2829 9.97992C10.1336 8.93495 10.9445 8.00002 12.0001 8.00002C13.0556 8.00002 13.8665 8.93495 13.7172 9.97992L13.1415 14.0101ZM13.5001 18.5C13.5001 19.3284 12.8285 20 12.0001 20C11.1716 20 10.5001 19.3284 10.5001 18.5C10.5001 17.6716 11.1716 17 12.0001 17C12.8285 17 13.5001 17.6716 13.5001 18.5Z</StreamGeometry>
<StreamGeometry x:Key="MessageBoxWindowErrorIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17.0352 16.8626C16.4597 17.4585 15.5101 17.4751 14.9142 16.8996L12.0368 14.121L9.25822 16.9984C8.68274 17.5943 7.73314 17.6109 7.13722 17.0354C6.5413 16.4599 6.52472 15.5103 7.1002 14.9144L9.87883 12.037L7.00147 9.2584C6.40555 8.68293 6.38897 7.73332 6.96445 7.1374C7.53992 6.54148 8.48953 6.52491 9.08545 7.10038L11.9628 9.87901L14.7414 7.00165C15.3169 6.40573 16.2665 6.38916 16.8624 6.96463C17.4584 7.54011 17.4749 8.48971 16.8995 9.08563L14.1208 11.963L16.9982 14.7416C17.5941 15.3171 17.6107 16.2667 17.0352 16.8626Z</StreamGeometry>
<StreamGeometry x:Key="MessageBoxWindowSuccessIconGlyph">M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17.8831 9.82235L11.6854 17.4112C11.4029 17.7806 10.965 17.9981 10.5 18C10.035 18.0019 9.59533 17.788 9.30982 17.421L5.81604 13.4209C5.30744 12.767 5.42524 11.8246 6.07916 11.316C6.73308 10.8074 7.67549 10.9252 8.1841 11.5791L10.4838 14.0439L15.5 8C16.0032 7.34193 16.9446 7.21641 17.6027 7.71964C18.2608 8.22287 18.3863 9.16428 17.8831 9.82235Z</StreamGeometry>
<x:Double x:Key="MessageBoxWindowContentMaxWidth">300</x:Double>
</ResourceDictionary>

View File

@@ -5,11 +5,12 @@
<MergeResourceInclude Source="Banner.axaml" /> <MergeResourceInclude Source="Banner.axaml" />
<MergeResourceInclude Source="ButtonGroup.axaml" /> <MergeResourceInclude Source="ButtonGroup.axaml" />
<MergeResourceInclude Source="Dialog.axaml" /> <MergeResourceInclude Source="Dialog.axaml" />
<MergeResourceInclude Source="DialogShared.axaml" />
<MergeResourceInclude Source="Divider.axaml" /> <MergeResourceInclude Source="Divider.axaml" />
<MergeResourceInclude Source="DualBadge.axaml" /> <MergeResourceInclude Source="DualBadge.axaml" />
<MergeResourceInclude Source="IPv4Box.axaml" /> <MergeResourceInclude Source="IPv4Box.axaml" />
<MergeResourceInclude Source="KeyGestureInput.axaml" /> <MergeResourceInclude Source="KeyGestureInput.axaml" />
<MergeResourceInclude Source="MessageBoxWindow.axaml" /> <MergeResourceInclude Source="MessageBox.axaml" />
<MergeResourceInclude Source="NavigationMenu.axaml" /> <MergeResourceInclude Source="NavigationMenu.axaml" />
<MergeResourceInclude Source="Pagination.axaml" /> <MergeResourceInclude Source="Pagination.axaml" />
<MergeResourceInclude Source="TagInput.axaml" /> <MergeResourceInclude Source="TagInput.axaml" />

View File

@@ -44,13 +44,13 @@ public class DefaultDialogControl: DialogControl
set => SetValue(ButtonsProperty, value); set => SetValue(ButtonsProperty, value);
} }
public static readonly StyledProperty<DialogIcon> IconProperty = AvaloniaProperty.Register<DefaultDialogControl, DialogIcon>( public static readonly StyledProperty<DialogMode> ModeProperty = AvaloniaProperty.Register<DefaultDialogControl, DialogMode>(
nameof(Icon)); nameof(Mode));
public DialogIcon Icon public DialogMode Mode
{ {
get => GetValue(IconProperty); get => GetValue(ModeProperty);
set => SetValue(IconProperty, value); set => SetValue(ModeProperty, value);
} }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

View File

@@ -34,13 +34,13 @@ public class DefaultDialogWindow: DialogWindow
set => SetValue(ButtonsProperty, value); set => SetValue(ButtonsProperty, value);
} }
public new static readonly StyledProperty<DialogIcon> IconProperty = AvaloniaProperty.Register<DefaultDialogWindow, DialogIcon>( public static readonly StyledProperty<DialogMode> ModeProperty = AvaloniaProperty.Register<DefaultDialogWindow, DialogMode>(
nameof(Icon)); nameof(Mode));
public new DialogIcon Icon public DialogMode Mode
{ {
get => GetValue(IconProperty); get => GetValue(ModeProperty);
set => SetValue(IconProperty, value); set => SetValue(ModeProperty, value);
} }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

View File

@@ -58,7 +58,7 @@ public static class Dialog
Window? owner, Window? owner,
TViewModel vm, TViewModel vm,
string? title = null, string? title = null,
DialogIcon icon = DialogIcon.None, DialogMode mode = DialogMode.None,
DialogButton buttons = DialogButton.OKCancel) DialogButton buttons = DialogButton.OKCancel)
where TView : Control, new() where TView : Control, new()
{ {
@@ -68,7 +68,7 @@ public static class Dialog
DataContext = vm, DataContext = vm,
Buttons = buttons, Buttons = buttons,
Title = title, Title = title,
Icon = icon, Mode = mode,
}; };
if (owner is null) if (owner is null)
{ {
@@ -85,12 +85,12 @@ public static class Dialog
public static async Task<DialogResult> ShowModalAsync<TView, TViewModel>( public static async Task<DialogResult> ShowModalAsync<TView, TViewModel>(
TViewModel vm, TViewModel vm,
string? title = null, string? title = null,
DialogIcon icon = DialogIcon.None, DialogMode mode = DialogMode.None,
DialogButton buttons = DialogButton.OKCancel) DialogButton buttons = DialogButton.OKCancel)
where TView: Control, new() where TView: Control, new()
{ {
var mainWindow = GetMainWindow(); var mainWindow = GetMainWindow();
return await ShowModalAsync<TView, TViewModel>(mainWindow, vm, title, icon, buttons); return await ShowModalAsync<TView, TViewModel>(mainWindow, vm, title, mode, buttons);
} }
private static Window? GetMainWindow() private static Window? GetMainWindow()
@@ -106,7 +106,7 @@ public static class OverlayDialog
TViewModel vm, TViewModel vm,
string? hostId = null, string? hostId = null,
string? title = null, string? title = null,
DialogIcon icon = DialogIcon.None, DialogMode mode = DialogMode.None,
DialogButton buttons = DialogButton.OKCancel) DialogButton buttons = DialogButton.OKCancel)
where TView : Control, new() where TView : Control, new()
{ {
@@ -116,7 +116,7 @@ public static class OverlayDialog
DataContext = vm, DataContext = vm,
Buttons = buttons, Buttons = buttons,
Title = title, Title = title,
Icon = icon, Mode = mode,
}; };
var host = OverlayDialogManager.GetHost(hostId); var host = OverlayDialogManager.GetHost(hostId);
host?.AddModalDialog(t); host?.AddModalDialog(t);
@@ -142,7 +142,7 @@ public static class OverlayDialog
TViewModel vm, TViewModel vm,
string? hostId = null, string? hostId = null,
string? title = null, string? title = null,
DialogIcon icon = DialogIcon.None, DialogMode mode = DialogMode.None,
DialogButton buttons = DialogButton.OKCancel) DialogButton buttons = DialogButton.OKCancel)
where TView: Control, new() where TView: Control, new()
{ {
@@ -152,7 +152,7 @@ public static class OverlayDialog
DataContext = vm, DataContext = vm,
Buttons = buttons, Buttons = buttons,
Title = title, Title = title,
Icon = icon, Mode = mode,
}; };
var host = OverlayDialogManager.GetHost(hostId); var host = OverlayDialogManager.GetHost(hostId);
host?.AddDialog(t); host?.AddDialog(t);

View File

@@ -1,6 +1,6 @@
namespace Ursa.Controls; namespace Ursa.Controls;
public enum DialogIcon public enum DialogMode
{ {
Info, Info,
Warning, Warning,

View File

@@ -63,7 +63,7 @@ public class OverlayDialogHost : Canvas
protected override void OnPointerMoved(PointerEventArgs e) protected override void OnPointerMoved(PointerEventArgs e)
{ {
base.OnPointerMoved(e); base.OnPointerMoved(e);
if (e.Source is DefaultDialogControl item) if (e.Source is DialogControl item)
{ {
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{ {
@@ -155,7 +155,7 @@ public class OverlayDialogHost : Canvas
// Handle dialog layer change event // Handle dialog layer change event
private void OnDialogLayerChanged(object sender, DialogLayerChangeEventArgs e) private void OnDialogLayerChanged(object sender, DialogLayerChangeEventArgs e)
{ {
if (sender is not DefaultDialogControl control) if (sender is not DialogControl control)
return; return;
if (!_dialogs.Contains(control)) if (!_dialogs.Contains(control))
return; return;