Merge pull request #775 from irihitech/clean

clean up controls XAML files
This commit is contained in:
Dong Bin
2025-09-19 16:45:50 +08:00
committed by GitHub
73 changed files with 237 additions and 615 deletions

View File

@@ -5,16 +5,16 @@
xmlns:semi="https://irihi.tech/semi"
xmlns:u-semi="https://irihi.tech/ursa/themes/semi"
xmlns:u="https://irihi.tech/ursa"
xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared">
xmlns:iri="https://irihi.tech/shared">
<Application.Styles>
<semi:SemiTheme Locale="zh-CN" />
<semi:SemiPopupAnimations/>
<semi:SemiPopupAnimations />
<u-semi:SemiTheme Locale="zh-CN" />
<!--This style is created to demonstrate Dialog StyleClass feature. This style is applied to Dialog Window-->
<Style Selector="u|DefaultDialogWindow.Custom">
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="Content" Value="CUSTOM"/>
<Setter Property="helpers:ClassHelper.Classes" Value="Warning"></Setter>
<Setter Property="Content" Value="CUSTOM" />
<Setter Property="iri:ClassHelper.Classes" Value="Warning" />
</Style>
</Style>
</Application.Styles>

View File

@@ -3,11 +3,11 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels"
xmlns:views="clr-namespace:Ursa.Demo.Views"
xmlns:iri="https://irihi.tech/shared"
Title="Ursa Demo"
d:DesignHeight="450"
d:DesignWidth="800"
@@ -26,7 +26,7 @@
<Style Selector="u|DefaultDialogControl.Custom">
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="Content" Value="CUSTOM" />
<Setter Property="helpers:ClassHelper.Classes" Value="Warning" />
<Setter Property="iri:ClassHelper.Classes" Value="Warning" />
</Style>
</Style>
</u:UrsaWindow.Styles>

View File

@@ -1,10 +1,9 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
<converters:TreeLevelToPaddingConverter x:Key="LevelToPaddingConverter" />
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<ControlTheme x:Key="{x:Type u:Anchor}" TargetType="{x:Type u:Anchor}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Top" />
@@ -51,7 +50,7 @@
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}">
<ContentPresenter.Padding>
<MultiBinding Converter="{StaticResource LevelToPaddingConverter}">
<MultiBinding Converter="{converters:TreeLevelToPaddingConverter}">
<Binding Path="Level" RelativeSource="{RelativeSource AncestorType={x:Type u:AnchorItem}}" />
<DynamicResource ResourceKey="AnchorIndent" />
</MultiBinding>

View File

@@ -1,8 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:AutoCompleteBox}" TargetType="u:AutoCompleteBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxDefaultHeight}" />

View File

@@ -1,8 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Converters;assembly=Ursa"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:converters="using:Ursa.Converters">
<Design.PreviewWith>
<StackPanel Orientation="Horizontal" Margin="20" Width="300" Spacing="10">
<u:Badge Header="5">
@@ -28,8 +28,6 @@
</StackPanel>
</Design.PreviewWith>
<converters:BadgeContentOverflowConverter x:Key="BadgeContentConverter" />
<ControlTheme x:Key="{x:Type u:Badge}" TargetType="{x:Type u:Badge}">
<!-- Set a very large corner radius to achieve pill look. -->
<Setter Property="CornerRadius" Value="{DynamicResource BadgeCornerRadius}" />
@@ -85,7 +83,7 @@
TextElement.Foreground="{TemplateBinding Foreground}"
ContentTemplate="{TemplateBinding HeaderTemplate}">
<ContentPresenter.Content>
<MultiBinding Converter="{StaticResource BadgeContentConverter}">
<MultiBinding Converter="{converters:BadgeContentOverflowConverter}">
<Binding Path="Header" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="OverflowCount" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>

View File

@@ -204,14 +204,14 @@
Classes="Tertiary"
Grid.Column="0"
Icon="{DynamicResource CalendarViewFastForwardGlyph}"
Theme="{DynamicResource BorderlessIconButton}"/>
Theme="{DynamicResource BorderlessIconButton}" />
<u:IconButton
Name="{x:Static u:CalendarView.PART_PreviousButton}"
Grid.Column="1"
Classes="Tertiary"
Icon="{DynamicResource CalendarItemPreviousIconGlyph}"
Theme="{DynamicResource BorderlessIconButton}"/>
Theme="{DynamicResource BorderlessIconButton}" />
<Grid Grid.Column="2" ColumnDefinitions="*, *">
<Button
@@ -239,13 +239,13 @@
Grid.Column="3"
Classes="Tertiary"
Icon="{DynamicResource CalendarItemNextIconGlyph}"
Theme="{DynamicResource BorderlessIconButton}"/>
Theme="{DynamicResource BorderlessIconButton}" />
<u:IconButton
Name="{x:Static u:CalendarView.PART_FastNextButton}"
Grid.Column="4"
Classes="Tertiary"
Icon="{DynamicResource CalendarViewFastBackwardGlyph}"
Theme="{DynamicResource BorderlessIconButton}"/>
Theme="{DynamicResource BorderlessIconButton}" />
</Grid>
<Grid
Name="{x:Static u:CalendarView.PART_MonthGrid}"

View File

@@ -1,10 +1,10 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<ControlTheme x:Key="{x:Type u:Clock}" TargetType="u:Clock">
<Setter Property="HandBrush" Value="{DynamicResource ClockHandBrush}"/>
<Setter Property="HandBrush" Value="{DynamicResource ClockHandBrush}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:Clock">
<Grid>
@@ -17,7 +17,7 @@
<UniformGrid Rows="2" IsVisible="{TemplateBinding ShowHourHand}">
<Border
Width="16"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converter:ClockHandLengthConverter.Hour}}"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converters:ClockHandLengthConverter.Hour}}"
VerticalAlignment="Bottom"
Background="{TemplateBinding HandBrush}"
CornerRadius="8" />
@@ -28,7 +28,7 @@
<UniformGrid Rows="2" IsVisible="{TemplateBinding ShowMinuteHand}">
<Border
Width="8"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converter:ClockHandLengthConverter.Minute}}"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converters:ClockHandLengthConverter.Minute}}"
VerticalAlignment="Bottom"
Background="{TemplateBinding HandBrush}"
CornerRadius="4" />
@@ -39,7 +39,7 @@
<UniformGrid Rows="2" IsVisible="{TemplateBinding ShowSecondHand}">
<Border
Width="4"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converter:ClockHandLengthConverter.Second}}"
Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width, Converter={x:Static converters:ClockHandLengthConverter.Second}}"
VerticalAlignment="Bottom"
Background="{TemplateBinding HandBrush}"
CornerRadius="4" />

View File

@@ -2,8 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared"
x:CompileBindings="True">
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type u:DateRangePicker}" TargetType="u:DateRangePicker">
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:DateTimePicker}" TargetType="u:DateTimePicker">
@@ -87,11 +88,12 @@
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
FontSize="{DynamicResource DefaultFontSize}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}" />
<u:TimePickerPresenter Grid.Column="1"
<u:TimePickerPresenter
Grid.Column="1"
Name="{x:Static u:DateTimePicker.PART_TimePicker}"
FontSize="{DynamicResource DefaultFontSize}"
NeedsConfirmation="{TemplateBinding NeedConfirmation}"
PanelFormat="{TemplateBinding PanelFormat}"/>
PanelFormat="{TemplateBinding PanelFormat}" />
</Grid>
</Border>
</Popup>

View File

@@ -17,8 +17,8 @@
<TransformOperationsTransition Property="RenderTransform" Duration="0.2" />
</Transitions>
</Setter>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="RenderTransform" Value="scale(1.0)" />
<Setter Property="Template">
<ControlTemplate TargetType="u:CustomDialogControl">
@@ -134,8 +134,8 @@
<Setter Property="MinWidth" Value="{DynamicResource DialogMinWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource DialogMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource DialogCornerRadius}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0.2" />

View File

@@ -1,4 +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">
<Design.PreviewWith>
<StackPanel Orientation="Horizontal" Margin="20">
<Button Theme="{DynamicResource CloseButton}" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
@@ -7,7 +8,7 @@
<ControlTemplate TargetType="u:DisableContainer">
<Panel>
<ContentPresenter Content="{TemplateBinding Content}" />
<iri:PureRectangle Background="Transparent" IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.IsEnabled, Converter={x:Static BoolConverters.Not}}" Cursor="No" ToolTip.Tip="{TemplateBinding DisabledTip}"/>
<iri:PureRectangle Background="Transparent" IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.IsEnabled, Converter={x:Static BoolConverters.Not}}" Cursor="No" ToolTip.Tip="{TemplateBinding DisabledTip}" />
</Panel>
</ControlTemplate>
</Setter>

View File

@@ -41,7 +41,7 @@
Foreground="{TemplateBinding Foreground}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{DynamicResource ThicknessDividerTextMargin}"
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"/>
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Rectangle Grid.Column="2" Theme="{StaticResource DividerRightLine}" />
</Grid>
</ControlTemplate>
@@ -62,7 +62,7 @@
Foreground="{TemplateBinding Foreground}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{DynamicResource ThicknessDividerTextMargin}"
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"/>
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Rectangle Grid.Column="2" Theme="{StaticResource DividerRightLine}" />
</Grid>
</ControlTemplate>
@@ -83,7 +83,7 @@
Foreground="{TemplateBinding Foreground}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{DynamicResource ThicknessDividerTextMargin}"
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"/>
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Rectangle Grid.Column="2" Theme="{StaticResource DividerRightLine}" />
</Grid>
</ControlTemplate>
@@ -104,7 +104,7 @@
Foreground="{TemplateBinding Foreground}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{DynamicResource ThicknessDividerTextMargin}"
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"/>
IsVisible="{Binding Content, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Rectangle Grid.Column="2" Theme="{StaticResource DividerRightLine}" />
</Grid>
</ControlTemplate>

View File

@@ -8,8 +8,8 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="96" />
<Setter Property="MinHeight" Value="96" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Padding" Value="{DynamicResource DrawerMargin}" />
<Setter Property="BorderThickness" Value="{DynamicResource DrawerBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource DrawerCornerRadius}" />
@@ -105,8 +105,8 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="96" />
<Setter Property="MinHeight" Value="96" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Padding" Value="{DynamicResource DrawerMargin}" />
<Setter Property="BorderThickness" Value="{DynamicResource DrawerBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource DrawerCornerRadius}" />

View File

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

View File

@@ -2,7 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters">
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<ControlTheme x:Key="{x:Type u:Form}"
TargetType="u:Form">
<Setter Property="Grid.IsSharedSizeScope"
@@ -80,8 +80,7 @@
<ControlTemplate TargetType="u:FormItem">
<Grid RowDefinitions="*, *">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"
SharedSizeGroup="Label" />
<ColumnDefinition Width="Auto" SharedSizeGroup="Label" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border
@@ -98,7 +97,7 @@
Name="PART_Label"
Content="{TemplateBinding Label}"
Background="Transparent"
FontWeight="{DynamicResource TextBlockTitleFontWeight}"/>
FontWeight="{DynamicResource TextBlockTitleFontWeight}" />
<TextBlock
Foreground="{DynamicResource FormAsteriskForeground}"
IsVisible="{TemplateBinding IsRequired}"

View File

@@ -2,7 +2,7 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters">
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<Design.PreviewWith>
<StackPanel Margin="20" Width="400">
<u:IconButton Icon="{StaticResource SemiIconCamera}"
@@ -29,7 +29,6 @@
<Button Theme="{DynamicResource BorderlessButton}" Classes="Danger" Content="Button" />
</StackPanel>
</Design.PreviewWith>
<converters:BooleansToOpacityConverter x:Key="OpacityConverter" />
<ControlTheme x:Key="{x:Type u:IconButton}" TargetType="u:IconButton">
<Setter Property="Padding" Value="{DynamicResource ButtonDefaultPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource ButtonDefaultHeight}" />
@@ -75,7 +74,7 @@
ContentTemplate="{TemplateBinding IconTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Foreground="{Binding #PART_ContentPresenter.Foreground}"
Opacity="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=!IsLoading, Converter={StaticResource OpacityConverter}}">
Opacity="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=!IsLoading, Converter={converters:BooleansToOpacityConverter}}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="Geometry">
<PathIcon

View File

@@ -1,9 +1,9 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
xmlns:iri="https://irihi.tech/shared"
xmlns:converters="using:Avalonia.Controls.Converters">
<converters:PlatformKeyGestureConverter x:Key="KeyGestureConverter" />
<ControlTheme x:Key="{x:Type u:KeyGestureInput}" TargetType="u:KeyGestureInput">
@@ -25,8 +25,9 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel VerticalAlignment="Stretch" Margin="{TemplateBinding Padding}">
<Grid ColumnDefinitions="Auto, *, Auto" >
<ContentPresenter Grid.Column="0"
<Grid ColumnDefinitions="Auto, *, Auto">
<ContentPresenter
Grid.Column="0"
Content="{TemplateBinding InnerLeftContent}"
Padding="{TemplateBinding Padding, Converter={iri:ThicknessMixerConverter Right}}"
DockPanel.Dock="Left"
@@ -49,9 +50,9 @@
Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Text="{TemplateBinding Gesture,
Converter={StaticResource KeyGestureConverter}}" />
<Button Grid.Column="1"
Text="{TemplateBinding Gesture,Converter={StaticResource KeyGestureConverter}}" />
<Button
Grid.Column="1"
Name="PART_ClearButton"
HorizontalAlignment="Right"
Command="{Binding $parent[u:KeyGestureInput].Clear}"

View File

@@ -1,15 +1,14 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="clr-namespace:Ursa.Controls;assembly=Ursa">
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<Design.PreviewWith>
<StackPanel Margin="20">
<u:LoadingIcon Classes="Large"/>
<u:LoadingIcon Classes="Large" />
</StackPanel>
</Design.PreviewWith>
<converters:BrushToColorConverter x:Key="BrushToColorConverter" />
<ControlTheme x:Key="{x:Type u:LoadingIcon}" TargetType="u:LoadingIcon">
<Setter Property="IsLoading" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource LoadingIconForeground}" />
@@ -29,8 +28,8 @@
<ConicGradientBrush Angle="50">
<GradientStops>
<GradientStop Offset="0.4" Color="Transparent" />
<GradientStop Offset="0.8" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
<GradientStop Offset="1.0" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
<GradientStop Offset="0.8" Color="{Binding Foreground, Converter={converters:BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
<GradientStop Offset="1.0" Color="{Binding Foreground, Converter={converters:BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</GradientStops>
</ConicGradientBrush>
</Arc.Stroke>

View File

@@ -1,8 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type u:Marquee}" TargetType="u:Marquee">
<Setter Property="Template">
<ControlTemplate>

View File

@@ -1,9 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa">
<converters:NavMenuMarginConverter x:Key="NavMarginConverter" />
xmlns:u="https://irihi.tech/ursa"
xmlns:converters="using:Ursa.Themes.Semi.Converters">
<ControlTheme x:Key="{x:Type u:NavMenu}" TargetType="u:NavMenu">
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
@@ -45,13 +44,9 @@
<Setter Property="Grid.IsSharedSizeScope" Value="False" />
</Style>
<Style Selector="^.enable_animation">
<Setter Property="u:SizeAnimationHelper.TriggerAvaloniaProperty"
Value="{x:Static u:NavMenu.IsHorizontalCollapsedProperty}">
</Setter>
<Setter Property="u:SizeAnimationHelper.CreateAnimation"
Value="{DynamicResource NavMenuWidthAnimationGenerator}">
</Setter>
<Setter Property="u:SizeAnimationHelper.EnableWHAnimation" Value="True"></Setter>
<Setter Property="u:SizeAnimationHelper.TriggerAvaloniaProperty" Value="{x:Static u:NavMenu.IsHorizontalCollapsedProperty}" />
<Setter Property="u:SizeAnimationHelper.CreateAnimation" Value="{DynamicResource NavMenuWidthAnimationGenerator}" />
<Setter Property="u:SizeAnimationHelper.EnableWHAnimation" Value="True" />
</Style>
</ControlTheme>
@@ -71,7 +66,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<Grid.Margin>
<MultiBinding Converter="{StaticResource NavMarginConverter}">
<MultiBinding Converter="{converters:NavMenuMarginConverter}">
<Binding Path="SubMenuIndent" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="Level" RelativeSource="{RelativeSource TemplatedParent}" />
<Binding Path="IsHorizontalCollapsed" RelativeSource="{RelativeSource TemplatedParent}" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>

View File

@@ -39,7 +39,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"
Cursor="SizeAll"/>
Cursor="SizeAll" />
<Button
Name="PART_ClearButton"
Margin="0,0,8,0"

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:RatingCharacter}" TargetType="u:RatingCharacter">

View File

@@ -1,8 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type u:WindowResizerThumb}" TargetType="u:WindowResizerThumb">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">

View File

@@ -38,7 +38,7 @@
<ControlTheme x:Key="{x:Type u:SelectionListItem}" TargetType="u:SelectionListItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="8" />
<Setter Property="Template">
<ControlTemplate TargetType="u:SelectionListItem">

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>
<u:ClosableTag Content="Closable Tag"/>
<u:ClosableTag Content="Closable Tag" />
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type u:TagInput}" TargetType="u:TagInput">
<Setter Property="InputTheme" Value="{DynamicResource TagInputTextBoxTheme}" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme TargetType="u:ThemeToggleButton" x:Key="{x:Type u:ThemeToggleButton}">

View File

@@ -1,8 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
<Design.PreviewWith>
<u:TimePickerPresenter Height="300" />
</Design.PreviewWith>
@@ -106,7 +106,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
<Setter Property="MinHeight" Value="32"/>
<Setter Property="MinHeight" Value="32" />
<Setter Property="Template">
<ControlTemplate TargetType="u:TimePicker">
<DataValidationErrors>
@@ -153,8 +153,7 @@
Name="{x:Static iri:PartNames.PART_Popup}"
Grid.Column="0"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropdownOpen,
Mode=TwoWay}"
IsOpen="{TemplateBinding IsDropdownOpen,Mode=TwoWay}"
Placement="BottomEdgeAlignedLeft"
PlacementTarget="Background">
<Border
@@ -178,19 +177,17 @@
Margin="8,8,8,0"
Content="{TemplateBinding PopupInnerTopContent}"
DockPanel.Dock="Top"
IsVisible="{TemplateBinding PopupInnerTopContent,
Converter={x:Static ObjectConverters.IsNotNull}}" />
IsVisible="{TemplateBinding PopupInnerTopContent,Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_PopupFooter"
Margin="8,0,8,8"
Content="{TemplateBinding PopupInnerBottomContent}"
DockPanel.Dock="Bottom"
IsVisible="{TemplateBinding PopupInnerBottomContent,
Converter={x:Static ObjectConverters.IsNotNull}}" />
IsVisible="{TemplateBinding PopupInnerBottomContent,Converter={x:Static ObjectConverters.IsNotNull}}" />
<u:TimePickerPresenter
Name="{x:Static u:TimePicker.PART_Presenter}"
NeedsConfirmation="{TemplateBinding NeedConfirmation}"
PanelFormat="{TemplateBinding PanelFormat}"/>
PanelFormat="{TemplateBinding PanelFormat}" />
</DockPanel>
</Border>
</Popup>
@@ -205,7 +202,7 @@
<Setter Property="IsVisible" Value="{Binding $parent[u:TimePicker].SelectedTime, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ Button#PART_Button">
<Setter Property="IsVisible" Value="{Binding $parent[u:TimePicker].SelectedTime, Converter={x:Static ObjectConverters.IsNull}}"/>
<Setter Property="IsVisible" Value="{Binding $parent[u:TimePicker].SelectedTime, Converter={x:Static ObjectConverters.IsNull}}" />
</Style>
</Style>

View File

@@ -1,8 +1,8 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared">
<ControlTheme x:Key="{x:Type u:TimeRangePicker}" TargetType="u:TimeRangePicker">
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />
@@ -138,8 +138,7 @@
Grid.Row="2"
Grid.Column="0"
NeedsConfirmation="{TemplateBinding NeedConfirmation}"
PanelFormat="{TemplateBinding PanelFormat}"
/>
PanelFormat="{TemplateBinding PanelFormat}" />
<Rectangle
Grid.Row="2"
Grid.Column="1"
@@ -152,8 +151,7 @@
Grid.Row="2"
Grid.Column="2"
NeedsConfirmation="{TemplateBinding NeedConfirmation}"
PanelFormat="{TemplateBinding PanelFormat}"
/>
PanelFormat="{TemplateBinding PanelFormat}" />
</Grid>
</DockPanel>
</Border>

View File

@@ -1,9 +1,7 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="https://irihi.tech/ursa"
xmlns:usemi="https://irihi.tech/ursa/themes/semi">
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>
<StackPanel Width="100" Spacing="20">
<u:Timeline>
@@ -23,14 +21,6 @@
</Setter>
</ControlTheme>
<converters:TimelineItemTypeToIconForegroundConverter
x:Key="ForegroundConverter"
DefaultBrush="{DynamicResource DefaultTimelineIconForeground}"
ErrorBrush="{DynamicResource ErrorTimelineIconForeground}"
OngoingBrush="{DynamicResource OngoingTimelineIconForeground}"
SuccessBrush="{DynamicResource SuccessTimelineIconForeground}"
WarningBrush="{DynamicResource WarningTimelineIconForeground}" />
<ControlTheme x:Key="{x:Type u:TimelineItem}" TargetType="u:TimelineItem">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
@@ -88,7 +78,7 @@
VerticalAlignment="Top"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
TextElement.FontSize="12"/>
TextElement.FontSize="12" />
<TextBlock
Name="{x:Static u:TimelineItem.PART_Time}"
Grid.Row="0"
@@ -111,28 +101,28 @@
<Setter Property="Fill" Value="Transparent" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Time">
<Setter Property="Foreground" Value="{DynamicResource TextBlockTertiaryForeground}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBlockTertiaryForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_Content">
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextBlockTertiaryForeground}"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextBlockTertiaryForeground}" />
</Style>
<Style Selector="^:empty-icon /template/ Ellipse#PART_DefaultIcon">
<Setter Property="IsVisible" Value="True"/>
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:empty-icon[Type=Default] /template/ Ellipse#PART_DefaultIcon">
<Setter Property="Fill" Value="{DynamicResource SemiGrey6}"/>
<Setter Property="Fill" Value="{DynamicResource SemiGrey6}" />
</Style>
<Style Selector="^:empty-icon[Type=Error] /template/ Ellipse#PART_DefaultIcon">
<Setter Property="Fill" Value="{DynamicResource SemiRed6}"/>
<Setter Property="Fill" Value="{DynamicResource SemiRed6}" />
</Style>
<Style Selector="^:empty-icon[Type=Ongoing] /template/ Ellipse#PART_DefaultIcon">
<Setter Property="Fill" Value="{DynamicResource SemiBlue6}"/>
<Setter Property="Fill" Value="{DynamicResource SemiBlue6}" />
</Style>
<Style Selector="^:empty-icon[Type=Success] /template/ Ellipse#PART_DefaultIcon">
<Setter Property="Fill" Value="{DynamicResource SemiGreen6}"/>
<Setter Property="Fill" Value="{DynamicResource SemiGreen6}" />
</Style>
<Style Selector="^:empty-icon[Type=Warning] /template/ Ellipse#PART_DefaultIcon">
<Setter Property="Fill" Value="{DynamicResource SemiOrange6}"/>
<Setter Property="Fill" Value="{DynamicResource SemiOrange6}" />
</Style>
<Style Selector="^:all-left">
<Style Selector="^ /template/ ContentPresenter#PART_Header">

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>

View File

@@ -25,9 +25,9 @@
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:ToolBar}" TargetType="u:ToolBar">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="ItemsPanel">
<ItemsPanelTemplate>
<u:ToolBarPanel />

View File

@@ -1,10 +1,10 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"
xmlns:converters1="clr-namespace:Ursa.Converters;assembly=Ursa"
xmlns:u="https://irihi.tech/ursa"
xmlns:iri="https://irihi.tech/shared"
xmlns:u="https://irihi.tech/ursa">
xmlns:converters="using:Avalonia.Controls.Converters"
xmlns:converters1="using:Ursa.Converters">
<Design.PreviewWith>
<StackPanel Height="300">
<u:TreeComboBox

View File

@@ -13,7 +13,7 @@
<Setter Property="u:OverlayDialogHost.IsModalStatusScope" Value="True" />
<Setter Property="IsMinimizeButtonVisible" Value="{OnPlatform {x:True},macOS={x:False}}" />
<Setter Property="IsRestoreButtonVisible" Value="{OnPlatform {x:True},macOS={x:False}}" />
<Setter Property="IsCloseButtonVisible" Value="{OnPlatform {x:True},macOS={x:False}}"/>
<Setter Property="IsCloseButtonVisible" Value="{OnPlatform {x:True},macOS={x:False}}" />
<Setter Property="SystemDecorations">
<OnPlatform>
<On Options="Default">

View File

@@ -5,11 +5,11 @@
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Badge.axaml" />
<ResourceInclude Source="Banner.axaml" />
<ResourceInclude Source="ButtonGroup.axaml" />
<ResourceInclude Source="Breadcrumb.axaml" />
<ResourceInclude Source="ButtonGroup.axaml" />
<ResourceInclude Source="Calendar.axaml" />
<ResourceInclude Source="ControlClassesInput.axaml" />
<ResourceInclude Source="Clock.axaml" />
<ResourceInclude Source="ControlClassesInput.axaml" />
<ResourceInclude Source="DatePicker.axaml" />
<ResourceInclude Source="DateRangePicker.axaml" />
<ResourceInclude Source="DateTimePicker.axaml" />
@@ -19,7 +19,6 @@
<ResourceInclude Source="Divider.axaml" />
<ResourceInclude Source="Drawer.axaml" />
<ResourceInclude Source="DualBadge.axaml" />
<ResourceInclude Source="ElasticWrapPanel.axaml" />
<ResourceInclude Source="EnumSelector.axaml" />
<ResourceInclude Source="Form.axaml" />
<ResourceInclude Source="IconButton.axaml" />
@@ -33,11 +32,11 @@
<ResourceInclude Source="MultiComboBox.axaml" />
<ResourceInclude Source="NavMenu.axaml" />
<ResourceInclude Source="Notification.axaml" />
<ResourceInclude Source="NumberDisplayer.axaml" />
<ResourceInclude Source="NumericUpDown.axaml" />
<ResourceInclude Source="NumPad.axaml" />
<ResourceInclude Source="NumberDisplayer.axaml" />
<ResourceInclude Source="Pagination.axaml" />
<ResourceInclude Source="PathPicker.axaml"/>
<ResourceInclude Source="PathPicker.axaml" />
<ResourceInclude Source="PinCode.axaml" />
<ResourceInclude Source="PopConfirm.axaml" />
<ResourceInclude Source="RangeSlider.axaml" />
@@ -46,18 +45,18 @@
<ResourceInclude Source="ScrollToButton.axaml" />
<ResourceInclude Source="SelectionList.axaml" />
<ResourceInclude Source="Skeleton.axaml" />
<ResourceInclude Source="SplashWindow.axaml"/>
<ResourceInclude Source="SplashWindow.axaml" />
<ResourceInclude Source="TagInput.axaml" />
<ResourceInclude Source="ThemeSelector.axaml" />
<ResourceInclude Source="TimeBox.axaml" />
<ResourceInclude Source="Timeline.axaml" />
<ResourceInclude Source="TimePicker.axaml" />
<ResourceInclude Source="TimeRangePicker.axaml" />
<ResourceInclude Source="Timeline.axaml" />
<ResourceInclude Source="TreeComboBox.axaml"/>
<ResourceInclude Source="TwoTonePathIcon.axaml" />
<ResourceInclude Source="Toast.axaml" />
<ResourceInclude Source="ToolBar.axaml" />
<ResourceInclude Source="TimeBox.axaml"/>
<ResourceInclude Source="TreeComboBox.axaml" />
<ResourceInclude Source="TwoTonePathIcon.axaml" />
<ResourceInclude Source="UrsaView.axaml" />
<ResourceInclude Source="UrsaWindow.axaml"/>
<ResourceInclude Source="UrsaWindow.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -1,21 +1,17 @@
using System.Globalization;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class BooleansToOpacityConverter: IValueConverter
public class BooleansToOpacityConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool b)
{
return b? 1.0: 0.0;
}
return 1;
return b ? 1.0 : 0.0;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
return 1;
}
}

View File

@@ -1,22 +1,18 @@
using System.Globalization;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class BrushToColorConverter: IValueConverter
public class BrushToColorConverter : MarkupValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is ISolidColorBrush b)
{
return b.Color;
}
return Colors.Transparent;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,25 +1,21 @@
using System.Globalization;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class ClockHandLengthConverter(double ratio) : IValueConverter
public class ClockHandLengthConverter(double ratio) : MarkupValueConverter
{
public static ClockHandLengthConverter Hour { get; } = new(1-0.618);
public static ClockHandLengthConverter Hour { get; } = new(1 - 0.618);
public static ClockHandLengthConverter Minute { get; } = new(0.618);
public static ClockHandLengthConverter Second { get; } = new(1);
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is double d)
{
return d * ratio / 2;
}
return 0.0;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,38 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data.Converters;
namespace Ursa.Themes.Semi.Converters;
[Obsolete("This converter is deprecated. Use CornerRadiusMixerConverter instead.")]
public class CornerRadiusTakeConverter: IValueConverter
{
private readonly Dock _dock;
internal CornerRadiusTakeConverter(Dock dock)
{
_dock = dock;
}
public static CornerRadiusTakeConverter Left { get; } = new(Dock.Left);
public static CornerRadiusTakeConverter Top { get; } = new(Dock.Top);
public static CornerRadiusTakeConverter Right { get; } = new(Dock.Right);
public static CornerRadiusTakeConverter Bottom { get; } = new(Dock.Bottom);
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if(value is not CornerRadius c) return AvaloniaProperty.UnsetValue;
return _dock switch
{
Dock.Left => new CornerRadius(c.TopLeft, 0, 0, c.BottomLeft),
Dock.Top => new CornerRadius(c.TopLeft, c.TopRight, 0, 0),
Dock.Right => new CornerRadius(0, c.TopRight, c.BottomRight, 0),
Dock.Bottom => new CornerRadius(0, 0, c.BottomRight, c.BottomLeft),
_ => AvaloniaProperty.UnsetValue
};
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,11 +1,10 @@
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data.Converters;
using Avalonia.Layout;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class FormContentHeightToAlignmentConverter: IValueConverter
public class FormContentHeightToAlignmentConverter : MarkupValueConverter
{
public static FormContentHeightToAlignmentConverter Instance = new(32);
public double Threshold { get; set; }
@@ -22,15 +21,9 @@ public class FormContentHeightToAlignmentConverter: IValueConverter
Threshold = threshold;
}
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if(value is not double d) return VerticalAlignment.Center;
if (value is not double d) return VerticalAlignment.Center;
return d > Threshold ? VerticalAlignment.Top : VerticalAlignment.Center;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,10 +1,10 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class FormContentHeightToMarginConverter: IValueConverter
public class FormContentHeightToMarginConverter : MarkupValueConverter
{
public static FormContentHeightToMarginConverter Instance = new();
public double Threshold { get; set; }
@@ -21,14 +21,9 @@ public class FormContentHeightToMarginConverter: IValueConverter
Threshold = threshold;
}
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if(value is not double d) return new Thickness(0);
if (value is not double d) return new Thickness(0);
return d > Threshold ? new Thickness(0, 8, 8, 0) : new Thickness(0, 0, 8, 0);
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,17 +1,18 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class NavMenuMarginConverter: IMultiValueConverter
public class NavMenuMarginConverter : MarkupMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is double indent && values[1] is int level && values[2] is bool b)
{
return b ? new Thickness() : new Thickness(indent * (level-1), 0, 0, 0);
return b ? new Thickness() : new Thickness(indent * (level - 1), 0, 0, 0);
}
return AvaloniaProperty.UnsetValue;
}
}

View File

@@ -1,37 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data.Converters;
namespace Ursa.Themes.Semi.Converters;
[Obsolete("This converter is deprecated. Use ThicknessMixerConverter instead.")]
public class ThicknessTakeConverter: IValueConverter
{
private readonly Dock _dock;
internal ThicknessTakeConverter(Dock dock)
{
_dock = dock;
}
public static ThicknessTakeConverter Left { get; } = new(Dock.Left);
public static ThicknessTakeConverter Top { get; } = new(Dock.Top);
public static ThicknessTakeConverter Right { get; } = new(Dock.Right);
public static ThicknessTakeConverter Bottom { get; } = new(Dock.Bottom);
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not Thickness t) return AvaloniaProperty.UnsetValue;
return _dock switch
{
Dock.Left => new Thickness(t.Left, 0, 0, 0),
Dock.Top => new Thickness(0, t.Top, 0, 0),
Dock.Right => new Thickness(0, 0, t.Right, 0),
Dock.Bottom => new Thickness(0, 0, 0, t.Bottom),
_ => AvaloniaProperty.UnsetValue
};
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,81 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Ursa.Controls;
namespace Ursa.Themes.Semi.Converters;
public class TimelineItemTypeToIconForegroundConverter: AvaloniaObject, IMultiValueConverter
{
public static readonly StyledProperty<IBrush> DefaultBrushProperty = AvaloniaProperty.Register<TimelineItemTypeToIconForegroundConverter, IBrush>(
nameof(DefaultBrush));
public IBrush DefaultBrush
{
get => GetValue(DefaultBrushProperty);
set => SetValue(DefaultBrushProperty, value);
}
public static readonly StyledProperty<IBrush> OngoingBrushProperty = AvaloniaProperty.Register<TimelineItemTypeToIconForegroundConverter, IBrush>(
nameof(OngoingBrush));
public IBrush OngoingBrush
{
get => GetValue(OngoingBrushProperty);
set => SetValue(OngoingBrushProperty, value);
}
public static readonly StyledProperty<IBrush> SuccessBrushProperty = AvaloniaProperty.Register<TimelineItemTypeToIconForegroundConverter, IBrush>(
nameof(SuccessBrush));
public IBrush SuccessBrush
{
get => GetValue(SuccessBrushProperty);
set => SetValue(SuccessBrushProperty, value);
}
public static readonly StyledProperty<IBrush> WarningBrushProperty = AvaloniaProperty.Register<TimelineItemTypeToIconForegroundConverter, IBrush>(
nameof(WarningBrush));
public IBrush WarningBrush
{
get => GetValue(WarningBrushProperty);
set => SetValue(WarningBrushProperty, value);
}
public static readonly StyledProperty<IBrush> ErrorBrushProperty = AvaloniaProperty.Register<TimelineItemTypeToIconForegroundConverter, IBrush>(
nameof(ErrorBrush));
public IBrush ErrorBrush
{
get => GetValue(ErrorBrushProperty);
set => SetValue(ErrorBrushProperty, value);
}
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is TimelineItemType type)
{
switch (type)
{
case TimelineItemType.Error:
return ErrorBrush;
case TimelineItemType.Warning:
return WarningBrush;
case TimelineItemType.Success:
return SuccessBrush;
case TimelineItemType.Ongoing:
return OngoingBrush;
case TimelineItemType.Default:
if (values[1] is IBrush brush)
{
return brush;
}
return DefaultBrush;
}
}
return AvaloniaProperty.UnsetValue;
}
}

View File

@@ -1,12 +1,12 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Themes.Semi.Converters;
public class TreeLevelToPaddingConverter : IMultiValueConverter
public class TreeLevelToPaddingConverter : MarkupMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values[0] is int i && values[1] is Thickness indent)
{

View File

@@ -1,9 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TimelineHeaderForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="DefaultTimelineIconForeground" ResourceKey="SemiColorFill2" />
<StaticResource x:Key="OngoingTimelineIconForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="SuccessTimelineIconForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="WarningTimelineIconForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ErrorTimelineIconForeground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="TimelineLineBrush" ResourceKey="SemiColorFill2" />
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Anchor.axaml" />
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Badge.axaml" />
<ResourceInclude Source="Banner.axaml" />
<ResourceInclude Source="Breadcrumb.axaml" />

View File

@@ -1,9 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TimelineHeaderForeground" ResourceKey="SemiColorText0" />
<StaticResource x:Key="DefaultTimelineIconForeground" ResourceKey="SemiColorFill2" />
<StaticResource x:Key="OngoingTimelineIconForeground" ResourceKey="SemiColorPrimary" />
<StaticResource x:Key="SuccessTimelineIconForeground" ResourceKey="SemiColorSuccess" />
<StaticResource x:Key="WarningTimelineIconForeground" ResourceKey="SemiColorWarning" />
<StaticResource x:Key="ErrorTimelineIconForeground" ResourceKey="SemiColorDanger" />
<StaticResource x:Key="TimelineLineBrush" ResourceKey="SemiColorFill2" />
</ResourceDictionary>

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Anchor.axaml" />
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Badge.axaml" />
<ResourceInclude Source="Banner.axaml" />
<ResourceInclude Source="Breadcrumb.axaml" />

View File

@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Anchor.axaml" />
<ResourceInclude Source="Avatar.axaml" />
<ResourceInclude Source="Badge.axaml" />
<ResourceInclude Source="Banner.axaml" />
<ResourceInclude Source="ButtonGroup.axaml" />

View File

@@ -1,11 +1,11 @@
using System.Globalization;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Converters;
public class BadgeContentOverflowConverter : IMultiValueConverter
public class BadgeContentOverflowConverter : MarkupMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
var overflowMark = parameter as string ?? "+";
if (double.TryParse(values[0]?.ToString(), out var b) && values[1] is int count and > 0)

View File

@@ -1,87 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
namespace Ursa.Converters;
[Obsolete("This converter is deprecated. Use CornerRadiusMixerConverter instead.")]
[Flags]
public enum CornerRadiusPosition
{
TopLeft = 1,
TopRight = 2,
BottomLeft = 4,
BottomRight = 8,
Top = 3,
Left = 5,
Right = 10,
Bottom = 12,
}
[Obsolete("This converter is deprecated. Use CornerRadiusMixerConverter instead.")]
public class CornerRadiusIncludeConverter(CornerRadiusPosition position) : IValueConverter
{
public static CornerRadiusIncludeConverter TopLeft { get; } = new( CornerRadiusPosition.TopLeft );
public static CornerRadiusIncludeConverter TopRight { get; } = new( CornerRadiusPosition.TopRight );
public static CornerRadiusIncludeConverter BottomLeft { get; } = new( CornerRadiusPosition.BottomLeft );
public static CornerRadiusIncludeConverter BottomRight { get; } = new( CornerRadiusPosition.BottomRight );
public static CornerRadiusIncludeConverter Top { get; } = new( CornerRadiusPosition.Top );
public static CornerRadiusIncludeConverter Left { get; } = new( CornerRadiusPosition.Left );
public static CornerRadiusIncludeConverter Right { get; } = new( CornerRadiusPosition.Right );
public static CornerRadiusIncludeConverter Bottom { get; } = new( CornerRadiusPosition.Bottom );
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is CornerRadius r)
{
double topLeft = position.HasFlag(CornerRadiusPosition.TopLeft) ? r.TopLeft : 0;
double topRight = position.HasFlag(CornerRadiusPosition.TopRight) ? r.TopRight : 0;
double bottomLeft = position.HasFlag(CornerRadiusPosition.BottomLeft) ? r.BottomLeft : 0;
double bottomRight = position.HasFlag(CornerRadiusPosition.BottomRight) ? r.BottomRight : 0;
return new CornerRadius(topLeft, topRight, bottomRight, bottomLeft);
}
return AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
[Obsolete("This converter is deprecated. Use CornerRadiusMixerConverter instead.")]
public class CornerRadiusExcludeConverter : IValueConverter
{
public static CornerRadiusExcludeConverter TopLeft { get; } = new( CornerRadiusPosition.TopLeft );
public static CornerRadiusExcludeConverter TopRight { get; } = new( CornerRadiusPosition.TopRight );
public static CornerRadiusExcludeConverter BottomLeft { get; } = new( CornerRadiusPosition.BottomLeft );
public static CornerRadiusExcludeConverter BottomRight { get; } = new( CornerRadiusPosition.BottomRight );
public static CornerRadiusExcludeConverter Top { get; } = new( CornerRadiusPosition.Top );
public static CornerRadiusExcludeConverter Left { get; } = new( CornerRadiusPosition.Left );
public static CornerRadiusExcludeConverter Right { get; } = new( CornerRadiusPosition.Right );
public static CornerRadiusExcludeConverter Bottom { get; } = new( CornerRadiusPosition.Bottom );
private readonly CornerRadiusPosition _position;
public CornerRadiusExcludeConverter(CornerRadiusPosition position)
{
_position = position;
}
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is CornerRadius r)
{
double topLeft = _position.HasFlag(CornerRadiusPosition.TopLeft) ? 0 : r.TopLeft;
double topRight = _position.HasFlag(CornerRadiusPosition.TopRight) ? 0 : r.TopRight;
double bottomLeft = _position.HasFlag(CornerRadiusPosition.BottomLeft) ? 0 : r.BottomLeft;
double bottomRight = _position.HasFlag(CornerRadiusPosition.BottomRight) ? 0 : r.BottomRight;
return new CornerRadius(topLeft, topRight, bottomRight, bottomLeft);
}
return AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -1,19 +1,20 @@
using System.Globalization;
using Avalonia.Controls.Templates;
using Avalonia.Data.Converters;
using Irihi.Avalonia.Shared.Converters;
namespace Ursa.Converters;
public class SelectionBoxTemplateConverter: IMultiValueConverter
public class SelectionBoxTemplateConverter : MarkupMultiValueConverter
{
public static SelectionBoxTemplateConverter Instance { get; } = new();
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
public override object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
for (int i = 0; i < values.Count; i++)
{
if (values[i] is IDataTemplate template) return template;
}
return null;
}
}

View File

@@ -1,82 +0,0 @@
using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
namespace Ursa.Converters;
[Obsolete("This converter is deprecated. Use ThicknessMixerConverter instead.")]
[Flags]
public enum ThicknessPosition
{
Left = 1,
Top = 2,
Right = 4,
Bottom = 8,
TopLeft = 3,
TopRight = 6,
BottomLeft = 9,
BottomRight = 12,
}
[Obsolete("This converter is deprecated. Use ThicknessMixerConverter instead.")]
public class ThicknessExcludeConverter(ThicknessPosition position) : IValueConverter
{
public static ThicknessExcludeConverter Left { get; } = new( ThicknessPosition.Left );
public static ThicknessExcludeConverter Top { get; } = new( ThicknessPosition.Top );
public static ThicknessExcludeConverter Right { get; } = new( ThicknessPosition.Right );
public static ThicknessExcludeConverter Bottom { get; } = new( ThicknessPosition.Bottom );
public static ThicknessExcludeConverter TopLeft { get; } = new( ThicknessPosition.TopLeft );
public static ThicknessExcludeConverter TopRight { get; } = new( ThicknessPosition.TopRight );
public static ThicknessExcludeConverter BottomLeft { get; } = new( ThicknessPosition.BottomLeft );
public static ThicknessExcludeConverter BottomRight { get; } = new( ThicknessPosition.BottomRight );
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is Thickness t)
{
double left = position.HasFlag(ThicknessPosition.Left) ? 0d: t.Left;
double top = position.HasFlag(ThicknessPosition.Top) ? 0d : t.Top;
double right = position.HasFlag(ThicknessPosition.Right) ? 0d : t.Right;
double bottom = position.HasFlag(ThicknessPosition.Bottom) ? 0d : t.Bottom;
return new Thickness(left, top, right, bottom);
}
return AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
[Obsolete("This converter is deprecated. Use ThicknessMixerConverter instead.")]
public class ThicknessIncludeConverter(ThicknessPosition position) : IValueConverter
{
public static ThicknessIncludeConverter Left { get; } = new( ThicknessPosition.Left );
public static ThicknessIncludeConverter Top { get; } = new( ThicknessPosition.Top );
public static ThicknessIncludeConverter Right { get; } = new( ThicknessPosition.Right );
public static ThicknessIncludeConverter Bottom { get; } = new( ThicknessPosition.Bottom );
public static ThicknessIncludeConverter TopLeft { get; } = new( ThicknessPosition.TopLeft );
public static ThicknessIncludeConverter TopRight { get; } = new( ThicknessPosition.TopRight );
public static ThicknessIncludeConverter BottomLeft { get; } = new( ThicknessPosition.BottomLeft );
public static ThicknessIncludeConverter BottomRight { get; } = new( ThicknessPosition.BottomRight );
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is Thickness t)
{
var left = position.HasFlag(ThicknessPosition.Left) ? t.Left : 0d;
var top = position.HasFlag(ThicknessPosition.Top) ? t.Top : 0d;
var right = position.HasFlag(ThicknessPosition.Right) ? t.Right : 0d;
var bottom = position.HasFlag(ThicknessPosition.Bottom) ? t.Bottom : 0d;
return new Thickness(left, top, right, bottom);
}
return AvaloniaProperty.UnsetValue;
}
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.3.0" />
<PackageReference Include="Irihi.Avalonia.Shared.Contracts" Version="0.3.0" />
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.3.1" />
<PackageReference Include="Irihi.Avalonia.Shared.Contracts" Version="0.3.1" />
</ItemGroup>
</Project>

View File

@@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
xmlns:helpers="clr-namespace:Irihi.Avalonia.Shared.Helpers;assembly=Irihi.Avalonia.Shared"
xmlns:iri="https://irihi.tech/shared"
mc:Ignorable="d" d:DesignWidth="800"
d:DesignHeight="450"
x:Class="HeadlessTest.Ursa.Controls.DialogTests.StyleClassTests.TestWindow"
@@ -16,7 +16,7 @@
</Style>
<Style Selector="u|DefaultDialogControl.Custom2">
<Style Selector="^ /template/ Button#PART_OKButton">
<Setter Property="helpers:ClassHelper.Classes" Value="Warning Small" />
<Setter Property="iri:ClassHelper.Classes" Value="Warning Small" />
</Style>
</Style>
</u:UrsaWindow.Styles>