Merge branch 'main' into tests

This commit is contained in:
Dong Bin
2025-01-10 22:10:28 +08:00
committed by GitHub
19 changed files with 392 additions and 389 deletions

View File

@@ -36,6 +36,7 @@ jobs:
- name: Commit wwwroot to GitHub Pages - name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0 uses: JamesIves/github-pages-deploy-action@v4.5.0
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages branch: gh-pages
FOLDER: ${{ env.OUTPUT_PATH }} folder: ${{ env.OUTPUT_PATH }}
single-commit: true

View File

@@ -4,54 +4,65 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
xmlns:pages="clr-namespace:Ursa.Demo.Pages"
xmlns:u="https://irihi.tech/ursa" xmlns:u="https://irihi.tech/ursa"
x:DataType="pages:BannerDemoViewModel" xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
x:DataType="vm:BannerDemoViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<Design.DataContext> <Design.DataContext>
<pages:BannerDemoViewModel /> <vm:BannerDemoViewModel />
</Design.DataContext> </Design.DataContext>
<ScrollViewer>
<StackPanel Spacing="20"> <StackPanel Spacing="20">
<Grid ColumnDefinitions="*, 300">
<Grid Grid.Column="0">
<Border Margin="20">
<u:Banner <u:Banner
Name="banner"
Classes.Bordered="{Binding Bordered}" Classes.Bordered="{Binding Bordered}"
Content="This is the Demo of Ursa Banner. " Header="{Binding Title}"
Header="Welcome to Ursa" Content="{Binding Content}" />
Width="300" <u:Form Width="500">
Height="100" <TextBox
HorizontalAlignment="Left" Classes="ClearButton"
VerticalAlignment="Top" IsEnabled="{Binding SetTitleNull}"
CanClose="True" Text="{Binding Title}">
Type="{Binding SelectedType}" /> <u:FormItem.Label>
</Border> <StackPanel Orientation="Horizontal">
</Grid> <CheckBox Content="Title" IsChecked="{Binding SetTitleNull}" />
<Border Grid.Column="1" VerticalAlignment="Top">
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *">
<Label
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center"
Content="Type" />
<ComboBox
Grid.Row="0"
Grid.Column="1"
MinWidth="200"
ItemsSource="{Binding Types}"
SelectedItem="{Binding SelectedType}" />
<Label
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center"
Content="Bordered" />
<ToggleSwitch
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
IsChecked="{Binding Bordered}" />
</Grid>
</Border>
</Grid>
</StackPanel> </StackPanel>
</u:FormItem.Label>
</TextBox>
<TextBox
Classes="ClearButton TextArea"
IsEnabled="{Binding SetContentNull}"
Text="{Binding Content}"
TextWrapping="Wrap">
<u:FormItem.Label>
<CheckBox Content="Content" IsChecked="{Binding SetContentNull}" />
</u:FormItem.Label>
</TextBox>
<u:EnumSelector
u:FormItem.Label="NotificationType"
EnumType="NotificationType"
Value="{Binding #banner.Type}" />
<u:EnumSelector
u:FormItem.Label="HorizontalContentAlignment"
EnumType="HorizontalAlignment"
Value="{Binding #banner.HorizontalContentAlignment}" />
<ToggleSwitch
Theme="{StaticResource SimpleToggleSwitch}"
u:FormItem.Label="Bordered"
IsChecked="{Binding Bordered}" />
<ToggleSwitch
Theme="{StaticResource SimpleToggleSwitch}"
u:FormItem.Label="ShowIcon"
IsChecked="{Binding #banner.ShowIcon}" />
<ToggleSwitch
Theme="{StaticResource SimpleToggleSwitch}"
u:FormItem.Label="CanClose"
IsChecked="{Binding #banner.CanClose}" />
<ToggleSwitch
Theme="{StaticResource SimpleToggleSwitch}"
u:FormItem.Label="IsVisible"
IsChecked="{Binding #banner.IsVisible}" />
</u:Form>
</StackPanel>
</ScrollViewer>
</UserControl> </UserControl>

View File

@@ -1,7 +1,4 @@
using System.Collections.ObjectModel;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels; using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages; namespace Ursa.Demo.Pages;
@@ -13,44 +10,4 @@ public partial class BannerDemo : UserControl
InitializeComponent(); InitializeComponent();
this.DataContext = new BannerDemoViewModel(); this.DataContext = new BannerDemoViewModel();
} }
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
public class BannerDemoViewModel : ViewModelBase
{
private ObservableCollection<NotificationType>? _types;
public ObservableCollection<NotificationType>? Types
{
get => _types;
set => SetProperty(ref _types, value);
}
private NotificationType _selectedType;
public NotificationType SelectedType
{
get => _selectedType;
set => SetProperty(ref _selectedType, value);
}
private bool _bordered;
public bool Bordered
{
get => _bordered;
set => SetProperty(ref _bordered, value);
}
public BannerDemoViewModel()
{
Types = new ObservableCollection<NotificationType>()
{
NotificationType.Information, NotificationType.Success, NotificationType.Warning, NotificationType.Error
};
}
} }

View File

@@ -13,14 +13,14 @@
<UserControl.Styles> <UserControl.Styles>
<Style Selector="Button"> <Style Selector="Button">
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="8"></Setter> <Setter Property="Margin" Value="8" />
</Style> </Style>
</UserControl.Styles> </UserControl.Styles>
<StackPanel HorizontalAlignment="Left"> <StackPanel HorizontalAlignment="Left">
<ComboBox ItemsSource="{Binding Icons}" SelectedItem="{Binding SelectedIcon}" /> <ComboBox ItemsSource="{Binding Icons}" SelectedItem="{Binding SelectedIcon}" />
<ToggleSwitch Content="Try Long Message" IsChecked="{Binding UseLong}"></ToggleSwitch> <ToggleSwitch Content="Try Long Message" IsChecked="{Binding UseLong}" />
<ToggleSwitch Content="Show Title" IsChecked="{Binding UseTitle}"></ToggleSwitch> <ToggleSwitch Content="Show Title" IsChecked="{Binding UseTitle}" />
<ToggleSwitch Content="Overlay" IsChecked="{Binding UseOverlay}"></ToggleSwitch> <ToggleSwitch Content="Overlay" IsChecked="{Binding UseOverlay}" />
<Button Command="{Binding DefaultMessageBoxCommand}" Content="Default" /> <Button Command="{Binding DefaultMessageBoxCommand}" Content="Default" />
<Button Command="{Binding OkCommand}" Content="OK" /> <Button Command="{Binding OkCommand}" Content="OK" />
<Button Command="{Binding OkCancelCommand}" Content="OKCancel" /> <Button Command="{Binding OkCancelCommand}" Content="OKCancel" />
@@ -28,8 +28,8 @@
<Button Command="{Binding YesNoCancelCommand}" Content="YesNoCancel" /> <Button Command="{Binding YesNoCancelCommand}" Content="YesNoCancel" />
<TextBlock> <TextBlock>
<Run Text="Last Clicked Result: "></Run> <Run Text="Last Clicked Result: " />
<Run Text="{Binding Result}"></Run> <Run Text="{Binding Result}" />
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@@ -1,6 +1,41 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.ViewModels; namespace Ursa.Demo.ViewModels;
public class BannerDemoViewModel: ViewModelBase public partial class BannerDemoViewModel : ViewModelBase
{ {
private string? _oldTitle = string.Empty;
private string? _oldContent = string.Empty;
[ObservableProperty] private string? _title = "Welcome to Ursa";
[ObservableProperty] private string? _content = "This is the Demo of Ursa Banner.";
[ObservableProperty] private bool _bordered;
[ObservableProperty] private bool _setTitleNull = true;
[ObservableProperty] private bool _setContentNull = true;
partial void OnSetTitleNullChanged(bool value)
{
if (value)
{
Title = _oldTitle;
}
else
{
_oldTitle = Title;
Title = null;
}
}
partial void OnSetContentNullChanged(bool value)
{
if (value)
{
Content = _oldContent;
}
else
{
_oldContent = Content;
Content = null;
}
}
} }

View File

@@ -0,0 +1,45 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="NotificationCloseButton" ResourceKey="OverlayCloseButton" />
<StaticResource x:Key="ToastCloseButton" ResourceKey="OverlayCloseButton" />
<ControlTheme x:Key="InnerPathIcon" TargetType="PathIcon">
<Setter Property="Height" Value="16" />
<Setter Property="Width" Value="16" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate TargetType="PathIcon">
<Border Background="{TemplateBinding Background}">
<Viewbox
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}">
<Path
Name="PART_Path"
Width="24"
Height="24"
Data="{TemplateBinding Data}"
Fill="{TemplateBinding Foreground}" />
</Viewbox>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^.Active /template/ Path#PART_Path">
<Setter Property="Fill" Value="{Binding BorderBrush,RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style Selector="^.ExtraSmall">
<Setter Property="Height" Value="8" />
<Setter Property="Width" Value="8" />
</Style>
<Style Selector="^.Small">
<Setter Property="Height" Value="12" />
<Setter Property="Width" Value="12" />
</Style>
<Style Selector="^.Large">
<Setter Property="Height" Value="20" />
<Setter Property="Width" Value="20" />
</Style>
<Style Selector="^.ExtraLarge">
<Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -1,5 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Compatibles/Icon.axaml" /> <ResourceInclude Source="/Compatibles/Icon.axaml" />
<ResourceInclude Source="/Compatibles/Theme.axaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -2,8 +2,18 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"> xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here --> <Design.PreviewWith>
<HeaderedContentControl Theme="{StaticResource GroupBox}" Width="500">
<u:Banner
Classes="Bordered"
Header="Title"
Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat"
Type="Warning"
CanClose="True" />
</HeaderedContentControl>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type u:Banner}" TargetType="u:Banner"> <ControlTheme x:Key="{x:Type u:Banner}" TargetType="u:Banner">
<Setter Property="Padding" Value="{DynamicResource BannerBorderPadding}" />
<Setter Property="BorderThickness" Value="{DynamicResource BannerBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource BannerBorderThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource BannerBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource BannerBorderBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
@@ -11,19 +21,16 @@
<ControlTemplate TargetType="u:Banner"> <ControlTemplate TargetType="u:Banner">
<Border <Border
Name="PART_Container" Name="PART_Container"
Padding="12" Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"> BorderThickness="{TemplateBinding BorderThickness}">
<Grid ColumnDefinitions="*, Auto"> <Grid ColumnDefinitions="*, Auto">
<Grid <Grid
Grid.Column="0" Grid.Column="0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ColumnDefinitions="Auto, *" ColumnDefinitions="Auto, *">
RowDefinitions="Auto, *">
<!-- Icon Area --> <!-- Icon Area -->
<Panel <Panel
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0" Grid.Column="0"
Margin="{DynamicResource BannerIconMargin}" Margin="{DynamicResource BannerIconMargin}"
VerticalAlignment="Top" VerticalAlignment="Top"
@@ -31,38 +38,31 @@
<ContentPresenter Content="{TemplateBinding Icon}" /> <ContentPresenter Content="{TemplateBinding Icon}" />
<PathIcon <PathIcon
Name="PART_BuildInIcon" Name="PART_BuildInIcon"
Width="16" Theme="{DynamicResource InnerPathIcon}"
Height="16" Classes="Large"
IsVisible="{TemplateBinding Icon, IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNull}}" />
Converter={x:Static ObjectConverters.IsNull}}" />
</Panel> </Panel>
<StackPanel Grid.Column="1" Spacing="2">
<ContentPresenter <ContentPresenter
Grid.Row="0"
Grid.Column="1"
Content="{TemplateBinding Header}" Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplate="{TemplateBinding HeaderTemplate}"
IsVisible="{TemplateBinding Header, TextTrimming="CharacterEllipsis"
Converter={x:Static ObjectConverters.IsNotNull}}" TextElement.FontSize="{DynamicResource BannerTitleFontSize}"
TextElement.FontWeight="{DynamicResource TextBlockTitleFontWeight}" /> TextElement.FontWeight="{DynamicResource TextBlockTitleFontWeight}" />
<ContentPresenter <ContentPresenter
Grid.Row="1"
Grid.Column="1"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" /> ContentTemplate="{TemplateBinding ContentTemplate}"
TextWrapping="Wrap" />
</StackPanel>
</Grid> </Grid>
<Button <Button
Name="{x:Static u:Banner.PART_CloseButton}" Name="{x:Static u:Banner.PART_CloseButton}"
Grid.Column="1" Grid.Column="1"
Padding="4" Margin="{DynamicResource BannerCloseButtonMargin}"
Cursor="Hand" HorizontalAlignment="Right"
IsVisible="{TemplateBinding CanClose}" VerticalAlignment="Top"
Theme="{DynamicResource BorderlessButton}"> Theme="{DynamicResource OverlayCloseButton}"
<PathIcon IsVisible="{TemplateBinding CanClose}" />
Width="12"
Height="12"
Data="{DynamicResource BannerCloseIconGeometry}"
Foreground="{DynamicResource BannerCloseButtonForeground}" />
</Button>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>

View File

@@ -76,9 +76,8 @@
<MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}"> <MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12" Data="{DynamicResource SemiIconClose}" />
Data="{DynamicResource WindowCloseIconGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</MenuFlyout> </MenuFlyout>
@@ -93,8 +92,7 @@
Header="{DynamicResource STRING_MENU_BRING_FORWARD}"> Header="{DynamicResource STRING_MENU_BRING_FORWARD}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeBringForwardGlyph}" /> Data="{DynamicResource DialogArrangeBringForwardGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -104,8 +102,7 @@
Header="{DynamicResource STRING_MENU_BRING_TO_FRONT}"> Header="{DynamicResource STRING_MENU_BRING_TO_FRONT}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeBringToFrontGlyph}" /> Data="{DynamicResource DialogArrangeBringToFrontGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -115,8 +112,7 @@
Header="{DynamicResource STRING_MENU_SEND_BACKWARD}"> Header="{DynamicResource STRING_MENU_SEND_BACKWARD}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeSendBackwardGlyph}" /> Data="{DynamicResource DialogArrangeSendBackwardGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -126,17 +122,15 @@
Header="{DynamicResource STRING_MENU_SEND_TO_BACK}"> Header="{DynamicResource STRING_MENU_SEND_TO_BACK}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeSendToBackGlyph}" /> Data="{DynamicResource DialogArrangeSendToBackGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}"> <MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12" Data="{DynamicResource SemiIconClose}" />
Data="{DynamicResource WindowCloseIconGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</MenuFlyout> </MenuFlyout>
@@ -186,8 +180,8 @@
<PathIcon <PathIcon
Name="PART_Icon" Name="PART_Icon"
Grid.Column="0" Grid.Column="0"
Width="16" Theme="{StaticResource InnerPathIcon}"
Height="16" Classes="ExtraLarge"
Margin="24,24,8,0" Margin="24,24,8,0"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
<TextBlock <TextBlock
@@ -392,9 +386,8 @@
<MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}"> <MenuItem Command="{Binding $parent[u:DialogControlBase].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12" Data="{DynamicResource SemiIconClose}" />
Data="{DynamicResource WindowCloseIconGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</MenuFlyout> </MenuFlyout>
@@ -409,8 +402,7 @@
Header="{DynamicResource STRING_MENU_BRING_FORWARD}"> Header="{DynamicResource STRING_MENU_BRING_FORWARD}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeBringForwardGlyph}" /> Data="{DynamicResource DialogArrangeBringForwardGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -420,8 +412,7 @@
Header="{DynamicResource STRING_MENU_BRING_TO_FRONT}"> Header="{DynamicResource STRING_MENU_BRING_TO_FRONT}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeBringToFrontGlyph}" /> Data="{DynamicResource DialogArrangeBringToFrontGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -431,8 +422,7 @@
Header="{DynamicResource STRING_MENU_SEND_BACKWARD}"> Header="{DynamicResource STRING_MENU_SEND_BACKWARD}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeSendBackwardGlyph}" /> Data="{DynamicResource DialogArrangeSendBackwardGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -442,8 +432,7 @@
Header="{DynamicResource STRING_MENU_SEND_TO_BACK}"> Header="{DynamicResource STRING_MENU_SEND_TO_BACK}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DialogArrangeSendToBackGlyph}" /> Data="{DynamicResource DialogArrangeSendToBackGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
@@ -453,9 +442,8 @@
Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}"> Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12" Data="{DynamicResource SemiIconClose}" />
Data="{DynamicResource WindowCloseIconGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</MenuFlyout> </MenuFlyout>
@@ -588,8 +576,8 @@
<PathIcon <PathIcon
Name="PART_Icon" Name="PART_Icon"
Grid.Column="0" Grid.Column="0"
Width="16" Theme="{StaticResource InnerPathIcon}"
Height="16" Classes="ExtraLarge"
Margin="24,24,8,0" Margin="24,24,8,0"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
<TextBlock <TextBlock

View File

@@ -1,28 +1,44 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here --> <Design.PreviewWith>
<ControlTheme x:Key="CloseButton" TargetType="Button"> <StackPanel Orientation="Horizontal" Margin="20">
<Button Theme="{DynamicResource CloseButton}" />
<Button Theme="{DynamicResource OverlayCloseButton}" />
<Button Theme="{DynamicResource NotificationCloseButton}" />
<Button Theme="{DynamicResource ToastCloseButton}" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="OverlayCloseButton" TargetType="Button">
<Setter Property="CornerRadius" Value="6" /> <Setter Property="CornerRadius" Value="6" />
<Setter Property="Margin" Value="0, 4" /> <Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="28" />
<Setter Property="Cursor" Value="Hand" /> <Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border <Border
Name="PART_Border"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
Background="Transparent" Background="Transparent"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<PathIcon <PathIcon
Width="12" Foreground="{DynamicResource SemiColorText1}"
Height="12" Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource WindowCloseIconGlyph}"/> Data="{DynamicResource SemiIconClose}" />
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:pointerover /template/ Border">
<Setter Property="Background" Value="{DynamicResource SemiColorFill1}" />
</Style>
<Style Selector="^:pressed /template/ Border">
<Setter Property="Background" Value="{DynamicResource SemiColorFill2}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="CloseButton"
BasedOn="{StaticResource OverlayCloseButton}"
TargetType="Button">
<Style Selector="^:pointerover /template/ Border"> <Style Selector="^:pointerover /template/ Border">
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" /> <Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
</Style> </Style>
@@ -38,34 +54,4 @@
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="OverlayCloseButton" TargetType="Button">
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Margin" Value="0, 4" />
<Setter Property="Padding" Value="4" />
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="28" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border
Name="PART_Border"
Padding="{TemplateBinding Padding}"
Background="Transparent"
CornerRadius="{TemplateBinding CornerRadius}">
<PathIcon
Width="12"
Height="12"
Data="{DynamicResource WindowCloseIconGlyph}"/>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -3,10 +3,35 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa" xmlns:u="https://irihi.tech/ursa"
xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared"> xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared">
<!-- Add Resources Here --> <Design.PreviewWith>
<StackPanel Margin="20">
<u:MessageBoxControl
Content="此修改将不可逆"
MessageIcon="None"
Buttons="OK" />
<u:MessageBoxControl
Content="此修改将不可逆"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
Content="此修改将不可逆"
MessageIcon="Warning"
Buttons="OKCancel" />
<u:MessageBoxControl
Title="确定是否要保存此修改?"
Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
MessageIcon="Warning"
Buttons="OKCancel" />
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type u:MessageBoxWindow}" TargetType="u:MessageBoxWindow"> <ControlTheme x:Key="{x:Type u:MessageBoxWindow}" TargetType="u:MessageBoxWindow">
<Setter Property="Title" Value="{x:Null}" /> <Setter Property="Title" Value="{x:Null}" />
<Setter Property="Background" Value="{DynamicResource SemiColorBackground2}" /> <Setter Property="Background" Value="{DynamicResource SemiColorBackground3}" />
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" /> <Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" /> <Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
@@ -47,8 +72,8 @@
<PathIcon <PathIcon
Name="PART_Icon" Name="PART_Icon"
Grid.Column="0" Grid.Column="0"
Width="24" Theme="{StaticResource InnerPathIcon}"
Height="24" Classes="ExtraLarge"
Margin="0,0,8,0" Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False" /> IsHitTestVisible="False" />
@@ -80,6 +105,7 @@
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
TextAlignment="Left" TextAlignment="Left"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</ScrollViewer> </ScrollViewer>
@@ -87,20 +113,13 @@
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="2"
Margin="24,0,24,24" Margin="24,0,24,24"
Spacing="8"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Orientation="Horizontal"> Orientation="Horizontal">
<Button <Button Name="{x:Static u:MessageBoxControl.PART_CancelButton}" />
Name="{x:Static u:MessageBoxWindow.PART_CancelButton}" <Button Name="{x:Static u:MessageBoxControl.PART_NoButton}" />
Margin="8,0,0,0" /> <Button Name="{x:Static u:MessageBoxControl.PART_YesButton}" />
<Button <Button Name="{x:Static u:MessageBoxControl.PART_OKButton}" />
Name="{x:Static u:MessageBoxWindow.PART_NoButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxWindow.PART_YesButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxWindow.PART_OKButton}"
Margin="8,0,0,0" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</VisualLayerManager> </VisualLayerManager>
@@ -113,19 +132,19 @@
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_CANCEL}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_CANCEL}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_NoButton"> <Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="Grid.Column" Value="1"></Setter> <Setter Property="Grid.Column" Value="1" />
<Setter Property="helpers:ClassHelper.Classes" Value="Danger" /> <Setter Property="helpers:ClassHelper.Classes" Value="Danger" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_NO}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_NO}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_YesButton"> <Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="Grid.Column" Value="2"></Setter> <Setter Property="Grid.Column" Value="2" />
<Setter Property="helpers:ClassHelper.Classes" Value="Primary" /> <Setter Property="helpers:ClassHelper.Classes" Value="Primary" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_YES}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_YES}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_OKButton"> <Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="Grid.Column" Value="3"></Setter> <Setter Property="Grid.Column" Value="3" />
<Setter Property="helpers:ClassHelper.Classes" Value="Primary" /> <Setter Property="helpers:ClassHelper.Classes" Value="Primary" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_OK}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_OK}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />
@@ -166,7 +185,7 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="{x:Type u:MessageBoxControl}" TargetType="u:MessageBoxControl"> <ControlTheme x:Key="{x:Type u:MessageBoxControl}" TargetType="u:MessageBoxControl">
<Setter Property="CornerRadius" Value="12" /> <Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="48 24" /> <Setter Property="Padding" Value="48 24" />
<Setter Property="u:DialogControlBase.CanDragMove" Value="True" /> <Setter Property="u:DialogControlBase.CanDragMove" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
@@ -178,7 +197,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Shadow" Classes="Shadow"
ClipToBounds="False" ClipToBounds="False"
Background="{DynamicResource SemiColorBackground2}" Background="{DynamicResource SemiColorBackground3}"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
IsHitTestVisible="True" IsHitTestVisible="True"
Theme="{DynamicResource CardBorder}"> Theme="{DynamicResource CardBorder}">
@@ -193,8 +212,8 @@
<PathIcon <PathIcon
Name="PART_Icon" Name="PART_Icon"
Grid.Column="0" Grid.Column="0"
Width="24" Theme="{StaticResource InnerPathIcon}"
Height="24" Classes="ExtraLarge"
Margin="24,24,8,0" Margin="24,24,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False" /> IsHitTestVisible="False" />
@@ -227,6 +246,7 @@
Name="PART_ContentPresenter" Name="PART_ContentPresenter"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
TextAlignment="Left" TextAlignment="Left"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</ScrollViewer> </ScrollViewer>
@@ -234,20 +254,13 @@
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="2"
Margin="24,0,24,24" Margin="24,0,24,24"
Spacing="8"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Orientation="Horizontal"> Orientation="Horizontal">
<Button <Button Name="{x:Static u:MessageBoxControl.PART_CancelButton}" />
Name="{x:Static u:MessageBoxControl.PART_CancelButton}" <Button Name="{x:Static u:MessageBoxControl.PART_NoButton}" />
Margin="8,0,0,0" /> <Button Name="{x:Static u:MessageBoxControl.PART_YesButton}" />
<Button <Button Name="{x:Static u:MessageBoxControl.PART_OKButton}" />
Name="{x:Static u:MessageBoxControl.PART_NoButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxControl.PART_YesButton}"
Margin="8,0,0,0" />
<Button
Name="{x:Static u:MessageBoxControl.PART_OKButton}"
Margin="8,0,0,0" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>
@@ -257,12 +270,11 @@
<Style Selector="^ /template/ Panel#PART_TitleArea"> <Style Selector="^ /template/ Panel#PART_TitleArea">
<Setter Property="ContextFlyout"> <Setter Property="ContextFlyout">
<MenuFlyout> <MenuFlyout>
<MenuItem Command="{Binding $parent[u:CustomDialogControl].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}"> <MenuItem Command="{Binding $parent[u:MessageBoxControl].Close}" Header="{DynamicResource STRING_MENU_DIALOG_CLOSE}">
<MenuItem.Icon> <MenuItem.Icon>
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12" Data="{DynamicResource SemiIconClose}" />
Data="{DynamicResource WindowCloseIconGlyph}" />
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
</MenuFlyout> </MenuFlyout>
@@ -274,19 +286,19 @@
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_CANCEL}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_CANCEL}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_NoButton"> <Style Selector="^ /template/ Button#PART_NoButton">
<Setter Property="Grid.Column" Value="1"></Setter> <Setter Property="Grid.Column" Value="1" />
<Setter Property="helpers:ClassHelper.Classes" Value="Danger" /> <Setter Property="helpers:ClassHelper.Classes" Value="Danger" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_NO}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_NO}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_YesButton"> <Style Selector="^ /template/ Button#PART_YesButton">
<Setter Property="Grid.Column" Value="2"></Setter> <Setter Property="Grid.Column" Value="2" />
<Setter Property="helpers:ClassHelper.Classes" Value="Primary" /> <Setter Property="helpers:ClassHelper.Classes" Value="Primary" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_YES}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_YES}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_OKButton"> <Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="Grid.Column" Value="3"></Setter> <Setter Property="Grid.Column" Value="3" />
<Setter Property="helpers:ClassHelper.Classes" Value="Primary" /> <Setter Property="helpers:ClassHelper.Classes" Value="Primary" />
<Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_OK}" /> <Setter Property="Content" Value="{DynamicResource STRING_MENU_DIALOG_OK}" />
<Setter Property="Theme" Value="{DynamicResource SolidButton}" /> <Setter Property="Theme" Value="{DynamicResource SolidButton}" />

View File

@@ -84,8 +84,8 @@
<DockPanel MinWidth="{DynamicResource NotificationCardMinWidth}"> <DockPanel MinWidth="{DynamicResource NotificationCardMinWidth}">
<PathIcon <PathIcon
x:Name="NotificationIcon" x:Name="NotificationIcon"
Width="{DynamicResource NotificationCardIconWidth}" Theme="{StaticResource InnerPathIcon}"
Height="{DynamicResource NotificationCardIconHeight}" Classes="Large"
Margin="{DynamicResource NotificationCardIconMargin}" Margin="{DynamicResource NotificationCardIconMargin}"
VerticalAlignment="Top" VerticalAlignment="Top"
IsVisible="{TemplateBinding ShowIcon}" IsVisible="{TemplateBinding ShowIcon}"
@@ -126,7 +126,7 @@
x:Name="PART_CloseButton" x:Name="PART_CloseButton"
VerticalAlignment="Top" VerticalAlignment="Top"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Theme="{StaticResource NotificationCloseButton}" Theme="{StaticResource OverlayCloseButton}"
IsVisible="{TemplateBinding ShowClose}" IsVisible="{TemplateBinding ShowClose}"
u:MessageCard.CloseOnClick="True" /> u:MessageCard.CloseOnClick="True" />
</DockPanel> </DockPanel>
@@ -432,32 +432,4 @@
</Style> </Style>
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="NotificationCloseButton" TargetType="Button">
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource NotificationCardCloseButtonForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border
Name="PART_Border"
Padding="{TemplateBinding Padding}"
Background="Transparent"
CornerRadius="{TemplateBinding CornerRadius}">
<PathIcon
Width="10"
Height="10"
Data="{DynamicResource WindowCloseIconGlyph}" />
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -56,8 +56,8 @@
<DockPanel> <DockPanel>
<PathIcon <PathIcon
x:Name="ToastIcon" x:Name="ToastIcon"
Width="{DynamicResource ToastCardIconWidth}" Theme="{StaticResource InnerPathIcon}"
Height="{DynamicResource ToastCardIconHeight}" Classes="Large"
Margin="{DynamicResource ToastCardIconMargin}" Margin="{DynamicResource ToastCardIconMargin}"
VerticalAlignment="Top" VerticalAlignment="Top"
IsVisible="{TemplateBinding ShowIcon}" IsVisible="{TemplateBinding ShowIcon}"
@@ -87,7 +87,7 @@
</ContentControl> </ContentControl>
<Button <Button
x:Name="PART_CloseButton" x:Name="PART_CloseButton"
Theme="{StaticResource ToastCloseButton}" Theme="{StaticResource OverlayCloseButton}"
VerticalAlignment="Top" VerticalAlignment="Top"
IsVisible="{TemplateBinding ShowClose}" IsVisible="{TemplateBinding ShowClose}"
u:MessageCard.CloseOnClick="True" /> u:MessageCard.CloseOnClick="True" />
@@ -220,31 +220,4 @@
</Style> </Style>
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="ToastCloseButton" TargetType="Button">
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border
Name="PART_Border"
Padding="{TemplateBinding Padding}"
Background="Transparent"
CornerRadius="{TemplateBinding CornerRadius}">
<PathIcon
Width="10"
Height="10"
Data="{DynamicResource WindowCloseIconGlyph}" />
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -6,7 +6,7 @@
<x:String x:Key="STRING_MENU_BRING_FORWARD">上移一层</x:String> <x:String x:Key="STRING_MENU_BRING_FORWARD">上移一层</x:String>
<x:String x:Key="STRING_MENU_SEND_BACKWARD">下移一层</x:String> <x:String x:Key="STRING_MENU_SEND_BACKWARD">下移一层</x:String>
<x:String x:Key="STRING_MENU_SEND_TO_BACK">置于底层</x:String> <x:String x:Key="STRING_MENU_SEND_TO_BACK">置于底层</x:String>
<x:String x:Key="STRING_MENU_DIALOG_OK">确</x:String> <x:String x:Key="STRING_MENU_DIALOG_OK">确</x:String>
<x:String x:Key="STRING_MENU_DIALOG_CANCEL">取消</x:String> <x:String x:Key="STRING_MENU_DIALOG_CANCEL">取消</x:String>
<x:String x:Key="STRING_MENU_DIALOG_YES">是</x:String> <x:String x:Key="STRING_MENU_DIALOG_YES">是</x:String>
<x:String x:Key="STRING_MENU_DIALOG_NO">否</x:String> <x:String x:Key="STRING_MENU_DIALOG_NO">否</x:String>
@@ -16,7 +16,7 @@
<x:String x:Key="STRING_THEME_TOGGLE_DARK">暗色</x:String> <x:String x:Key="STRING_THEME_TOGGLE_DARK">暗色</x:String>
<x:String x:Key="STRING_THEME_TOGGLE_LIGHT">亮色</x:String> <x:String x:Key="STRING_THEME_TOGGLE_LIGHT">亮色</x:String>
<x:String x:Key="STRING_THEME_TOGGLE_SYSTEM">跟随系统</x:String> <x:String x:Key="STRING_THEME_TOGGLE_SYSTEM">跟随系统</x:String>
<x:String x:Key="STRING_DATE_TIME_CONFIRM">确</x:String> <x:String x:Key="STRING_DATE_TIME_CONFIRM">确</x:String>
<x:String x:Key="STRING_DATE_TIME_START_TIME">开始时间</x:String> <x:String x:Key="STRING_DATE_TIME_START_TIME">开始时间</x:String>
<x:String x:Key="STRING_DATE_TIME_END_TIME">结束时间</x:String> <x:String x:Key="STRING_DATE_TIME_END_TIME">结束时间</x:String>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -0,0 +1,18 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>
<Border Padding="20">
<!-- Add Controls for Previewer Here -->
</Border>
</Design.PreviewWith>
<Style Selector=":is(u|UrsaWindow)[ExtendClientAreaToDecorationsHint=True] u|WindowNotificationManager">
<Style Selector="^:topright">
<Setter Property="Margin" Value="0 36 0 0"></Setter>
</Style>
</Style>
<Style Selector=":is(u|UrsaWindow)[ExtendClientAreaToDecorationsHint=True] u|WindowToastManager">
<Setter Property="Margin" Value="0 36 0 0"></Setter>
</Style>
</Styles>

View File

@@ -11,5 +11,6 @@
<StyleInclude Source="ToolBar.axaml"/> <StyleInclude Source="ToolBar.axaml"/>
<StyleInclude Source="TimeBox.axaml"/> <StyleInclude Source="TimeBox.axaml"/>
<StyleInclude Source="UrsaView.axaml" /> <StyleInclude Source="UrsaView.axaml" />
<StyleInclude Source="UrsaWindow.axaml" />
<!-- Add Styles Here --> <!-- Add Styles Here -->
</Styles> </Styles>

View File

@@ -6,6 +6,9 @@
<StaticResource x:Key="BannerCloseIconGeometry" ResourceKey="SemiIconClose" /> <StaticResource x:Key="BannerCloseIconGeometry" ResourceKey="SemiIconClose" />
<CornerRadius x:Key="BannerCornerRadius">3</CornerRadius> <CornerRadius x:Key="BannerCornerRadius">3</CornerRadius>
<Thickness x:Key="BannerBorderPadding">12</Thickness>
<Thickness x:Key="BannerBorderThickness">1</Thickness> <Thickness x:Key="BannerBorderThickness">1</Thickness>
<Thickness x:Key="BannerIconMargin">0 0 12 0</Thickness> <Thickness x:Key="BannerIconMargin">0 0 12 0</Thickness>
<Thickness x:Key="BannerCloseButtonMargin">12 0 0 0</Thickness>
<x:Double x:Key="BannerTitleFontSize">18</x:Double>
</ResourceDictionary> </ResourceDictionary>

View File

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

View File

@@ -76,7 +76,7 @@ public class StyleClassTests
Assert.DoesNotContain("Custom", dialog.Classes); Assert.DoesNotContain("Custom", dialog.Classes);
var okButton = dialog.GetVisualDescendants().OfType<Button>().SingleOrDefault(a=>a.Name == DefaultDialogControl.PART_OKButton); var okButton = dialog.GetVisualDescendants().OfType<Button>().SingleOrDefault(a=>a.Name == DefaultDialogControl.PART_OKButton);
Assert.NotNull(okButton); Assert.NotNull(okButton);
Assert.Equal("确", okButton.Content); Assert.Equal("确", okButton.Content);
var cancelButton = dialog.GetVisualDescendants().OfType<Button>().SingleOrDefault(a=>a.Name == DefaultDialogControl.PART_CancelButton); var cancelButton = dialog.GetVisualDescendants().OfType<Button>().SingleOrDefault(a=>a.Name == DefaultDialogControl.PART_CancelButton);
Assert.NotNull(cancelButton); Assert.NotNull(cancelButton);
Assert.Equal("取消", cancelButton.Content); Assert.Equal("取消", cancelButton.Content);