committed by
GitHub
39 changed files with 971 additions and 395 deletions
@ -1,66 +1,36 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="ControlCatalog.Pages.ViewboxPage"> |
|||
<UserControl.Resources> |
|||
<StreamGeometry x:Key="Acorn"> |
|||
F1 M 16.6309,18.6563C 17.1309, |
|||
8.15625 29.8809,14.1563 29.8809, |
|||
14.1563C 30.8809,11.1563 34.1308, |
|||
11.4063 34.1308,11.4063C 33.5,12 |
|||
34.6309,13.1563 34.6309,13.1563C |
|||
32.1309,13.1562 31.1309,14.9062 |
|||
31.1309,14.9062C 41.1309,23.9062 |
|||
32.6309,27.9063 32.6309,27.9062C |
|||
24.6309,24.9063 21.1309,22.1562 |
|||
16.6309,18.6563 Z M 16.6309,19.9063C |
|||
21.6309,24.1563 25.1309,26.1562 |
|||
31.6309,28.6562C 31.6309,28.6562 |
|||
26.3809,39.1562 18.3809,36.1563C |
|||
18.3809,36.1563 18,38 16.3809,36.9063C |
|||
15,36 16.3809,34.9063 16.3809,34.9063C |
|||
16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z |
|||
</StreamGeometry> |
|||
</UserControl.Resources> |
|||
|
|||
<Grid RowDefinitions="Auto,*"> |
|||
<Grid RowDefinitions="Auto,*,*"> |
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<TextBlock Classes="h1">Viewbox</TextBlock> |
|||
<TextBlock Classes="h2">A control used to scale single child.</TextBlock> |
|||
</StackPanel> |
|||
<Grid ColumnDefinitions="Auto,*,*" |
|||
RowDefinitions="*,*,*,*" |
|||
Grid.Row="1" Margin="48" |
|||
MaxWidth="400"> |
|||
<TextBlock Grid.Row="0" VerticalAlignment="Center">None</TextBlock> |
|||
<TextBlock Grid.Row="1" VerticalAlignment="Center">Fill</TextBlock> |
|||
<TextBlock Grid.Row="2" VerticalAlignment="Center">Uniform</TextBlock> |
|||
<TextBlock Grid.Row="3" VerticalAlignment="Center">UniformToFill</TextBlock> |
|||
|
|||
<Viewbox Grid.Row="0" Grid.Column="1" Stretch="None"> |
|||
<TextBlock>Hello World!</TextBlock> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="1" Grid.Column="1" Stretch="Fill"> |
|||
<TextBlock>Hello World!</TextBlock> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="2" Grid.Column="1" Stretch="Uniform"> |
|||
<TextBlock>Hello World!</TextBlock> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="3" Grid.Column="1" Stretch="UniformToFill"> |
|||
<TextBlock>Hello World!</TextBlock> |
|||
</Viewbox> |
|||
<Grid Grid.Row="1" ColumnDefinitions="*,Auto" HorizontalAlignment="Center" Margin="0,10,0,0"> |
|||
|
|||
<Viewbox Grid.Row="0" Grid.Column="2" Stretch="None"> |
|||
<Path Fill="Blue" Data="{StaticResource Acorn}"/> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="1" Grid.Column="2" Stretch="Fill"> |
|||
<Path Fill="Blue" Data="{StaticResource Acorn}"/> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="2" Grid.Column="2" Stretch="Uniform"> |
|||
<Path Fill="Blue" Data="{StaticResource Acorn}"/> |
|||
</Viewbox> |
|||
<Viewbox Grid.Row="3" Grid.Column="2" Stretch="UniformToFill"> |
|||
<Path Fill="Blue" Data="{StaticResource Acorn}"/> |
|||
</Viewbox> |
|||
<Border HorizontalAlignment="Center" Grid.Column="0" BorderThickness="1" BorderBrush="Orange" Width="200" Height="200"> |
|||
<Border VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" BorderThickness="1" BorderBrush="CornflowerBlue" Width="{Binding #WidthSlider.Value}" Height="{Binding #HeightSlider.Value}" > |
|||
<Viewbox |
|||
Stretch="{Binding #StretchSelector.SelectedItem}" |
|||
StretchDirection="{Binding #StretchDirectionSelector.SelectedItem}"> |
|||
<Ellipse Width="50" Height="50" Fill="CornflowerBlue" /> |
|||
</Viewbox> |
|||
</Border> |
|||
</Border> |
|||
|
|||
<StackPanel HorizontalAlignment="Left" Orientation="Vertical" Grid.Column="1" Margin="8,0,0,0" Width="150"> |
|||
<TextBlock Text="Width" /> |
|||
<Slider Minimum="10" Maximum="200" Value="100" x:Name="WidthSlider" TickFrequency="25" TickPlacement="TopLeft" /> |
|||
<TextBlock Text="Height" /> |
|||
<Slider Minimum="10" Maximum="200" Value="100" x:Name="HeightSlider" TickFrequency="25" TickPlacement="TopLeft" /> |
|||
<TextBlock Text="Stretch" /> |
|||
<ComboBox x:Name="StretchSelector" HorizontalAlignment="Stretch" Margin="0,0,0,2" /> |
|||
<TextBlock Text="Stretch Direction" /> |
|||
<ComboBox x:Name="StretchDirectionSelector" HorizontalAlignment="Stretch" /> |
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
</Grid> |
|||
</UserControl> |
|||
|
|||
@ -1,141 +1,232 @@ |
|||
<Styles xmlns="https://github.com/avaloniaui"> |
|||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<Design.PreviewWith> |
|||
<Border Padding="20"> |
|||
<StackPanel Orientation="Vertical" Spacing="20"> |
|||
<Expander ExpandDirection="Up" Header="Expand Up"> |
|||
<StackPanel> |
|||
<TextBlock>Expanded content</TextBlock> |
|||
</StackPanel> |
|||
</Expander> |
|||
<Expander ExpandDirection="Down" Header="Expand Down"> |
|||
<StackPanel> |
|||
<TextBlock>Expanded content</TextBlock> |
|||
</StackPanel> |
|||
</Expander> |
|||
<Expander ExpandDirection="Left" Header="Expand Left"> |
|||
<StackPanel> |
|||
<TextBlock>Expanded content</TextBlock> |
|||
</StackPanel> |
|||
</Expander> |
|||
<Expander ExpandDirection="Right" Header="Expand Right"> |
|||
<StackPanel> |
|||
<TextBlock>Expanded content</TextBlock> |
|||
</StackPanel> |
|||
</Expander> |
|||
</StackPanel> |
|||
</Border> |
|||
</Design.PreviewWith> |
|||
|
|||
<Styles.Resources> |
|||
<Thickness x:Key="ExpanderHeaderPadding">16</Thickness> |
|||
<Thickness x:Key="ExpanderContentPadding">16</Thickness> |
|||
|
|||
<Thickness x:Key="ExpanderBorderThickness">1</Thickness> |
|||
|
|||
<Thickness x:Key="ExpanderDropdownLeftBorderThickness">1,1,0,1</Thickness> |
|||
<Thickness x:Key="ExpanderDropdownUpBorderThickness">1,1,1,0</Thickness> |
|||
<Thickness x:Key="ExpanderDropdownRightBorderThickness">0,1,1,1</Thickness> |
|||
<Thickness x:Key="ExpanderDropdownDownBorderThickness">1,0,1,1</Thickness> |
|||
|
|||
<SolidColorBrush x:Key="ExpanderBackground" Color="{DynamicResource SystemAltMediumHighColor}" /> |
|||
<SolidColorBrush x:Key="ExpanderBorderBrush" Color="{DynamicResource SystemBaseLowColor}" /> |
|||
|
|||
<SolidColorBrush x:Key="ExpanderDropDownBackground" Color="{DynamicResource SystemChromeMediumLowColor}" /> |
|||
<SolidColorBrush x:Key="ExpanderDropDownBorderBrush" Color="{DynamicResource SystemBaseLowColor}" /> |
|||
|
|||
<SolidColorBrush x:Key="ExpanderForeground" Color="{DynamicResource SystemBaseHighColor}" /> |
|||
|
|||
<SolidColorBrush x:Key="ExpanderChevronForeground" Color="{DynamicResource SystemBaseHighColor}" /> |
|||
</Styles.Resources> |
|||
<Style Selector="Expander"> |
|||
<Setter Property="ContentTransition"> |
|||
<Setter.Value> |
|||
<CrossFade Duration="00:00:00.25" /> |
|||
</Setter.Value> |
|||
</Setter> |
|||
<Setter Property="Background" Value="{DynamicResource ExpanderBackground}" /> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderBorderThickness}" /> |
|||
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderBorderBrush}" /> |
|||
<Setter Property="Padding" Value="{DynamicResource ExpanderHeaderPadding}" /> |
|||
<Setter Property="HorizontalAlignment" Value="Stretch" /> |
|||
<Setter Property="HorizontalContentAlignment" Value="Left" /> |
|||
<Setter Property="VerticalContentAlignment" Value="Center" /> |
|||
</Style> |
|||
<Style Selector="Expander[ExpandDirection=Down]"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"> |
|||
<Grid RowDefinitions="Auto,*"> |
|||
<ToggleButton Name="PART_toggle" Grid.Row="0" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
|||
<ContentPresenter Name="PART_ContentPresenter" |
|||
Grid.Row="1" |
|||
IsVisible="{TemplateBinding IsExpanded}" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
Padding="{TemplateBinding Padding}" /> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="Expander[IsExpanded=true] /template/ ToggleButton#PART_toggle /template/ ContentPresenter#PART_ContentPresenter"> |
|||
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForeground}"/> |
|||
</Style> |
|||
<Style Selector="Expander[ExpandDirection=Up]"> |
|||
<Style Selector="Expander"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"> |
|||
<Grid RowDefinitions="*,Auto"> |
|||
<ToggleButton Name="PART_toggle" Grid.Row="1" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
|||
<ContentPresenter Name="PART_ContentPresenter" |
|||
Grid.Row="0" |
|||
IsVisible="{TemplateBinding IsExpanded}" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
<DockPanel> |
|||
<ToggleButton x:Name="ExpanderHeader" |
|||
Padding="{TemplateBinding Padding}" |
|||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
|||
Background="{TemplateBinding Background}" |
|||
BorderBrush="{TemplateBinding BorderBrush}" |
|||
BorderThickness="{TemplateBinding BorderThickness}" |
|||
Content="{TemplateBinding Header}" |
|||
ContentTemplate="{TemplateBinding HeaderTemplate}" |
|||
IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
|||
IsEnabled="{TemplateBinding IsEnabled}" /> |
|||
<Border x:Name="ExpanderContent" |
|||
Padding="{DynamicResource ExpanderContentPadding}" |
|||
Background="{DynamicResource ExpanderDropDownBackground}" |
|||
BorderBrush="{DynamicResource ExpanderDropDownBorderBrush}" |
|||
IsVisible="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"> |
|||
<ContentPresenter x:Name="PART_ContentPresenter" |
|||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
Padding="{TemplateBinding Padding}" /> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="Expander[ExpandDirection=Right]"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"> |
|||
<Grid ColumnDefinitions="Auto,*"> |
|||
<ToggleButton Name="PART_toggle" Grid.Column="0" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
|||
<ContentPresenter Name="PART_ContentPresenter" |
|||
Grid.Column="1" |
|||
IsVisible="{TemplateBinding IsExpanded}" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
Padding="{TemplateBinding Padding}" /> |
|||
</Grid> |
|||
</Border> |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" /> |
|||
</Border> |
|||
</DockPanel> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="Expander[ExpandDirection=Left]"> |
|||
|
|||
<Style Selector="Expander /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="HorizontalContentAlignment" Value="Left" /> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}"> |
|||
<Border x:Name="ToggleButtonBackground"> |
|||
<Grid ColumnDefinitions="*,Auto"> |
|||
<ToggleButton Name="PART_toggle" Grid.Column="1" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
|||
<ContentPresenter Name="PART_ContentPresenter" |
|||
Grid.Column="0" |
|||
IsVisible="{TemplateBinding IsExpanded}" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" |
|||
<ContentPresenter x:Name="PART_ContentPresenter" |
|||
Margin="{TemplateBinding Padding}" |
|||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
Padding="{TemplateBinding Padding}" /> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="Expander /template/ ToggleButton#PART_toggle"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border BorderThickness="1" Background="Transparent"> |
|||
<Grid ColumnDefinitions="Auto,Auto"> |
|||
<Border Grid.Column="0" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center"> |
|||
<Path Fill="{DynamicResource SystemControlForegroundBaseHighBrush}" |
|||
HorizontalAlignment="Center" |
|||
VerticalAlignment="Center" |
|||
Data="M 0 2 L 4 6 L 0 10 Z" /> |
|||
VerticalContentAlignment="Center" |
|||
Background="Transparent" |
|||
BorderBrush="Transparent" |
|||
BorderThickness="0" |
|||
Content="{TemplateBinding Content}" |
|||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
TextBlock.Foreground="{DynamicResource ExpanderForeground}" /> |
|||
<Border x:Name="ExpandCollapseChevronBorder" |
|||
Grid.Column="1" |
|||
Width="32" |
|||
Height="32" |
|||
Margin="7" |
|||
RenderTransformOrigin="50%,50%"> |
|||
<Path x:Name="ExpandCollapseChevron" |
|||
HorizontalAlignment="Center" |
|||
VerticalAlignment="Center" |
|||
RenderTransformOrigin="50%,50%" |
|||
Stretch="None" |
|||
Stroke="{DynamicResource ExpanderChevronForeground}" |
|||
StrokeThickness="1" /> |
|||
<Border.RenderTransform> |
|||
<RotateTransform /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
<ContentPresenter Name="PART_ContentPresenter" |
|||
Grid.Column="1" |
|||
Background="Transparent" |
|||
Content="{TemplateBinding Content}" |
|||
VerticalAlignment="Center" |
|||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|||
Padding="{TemplateBinding Padding}"/> |
|||
</Grid> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
<Style Selector="Expander /template/ ToggleButton#PART_toggle:pointerover /template/ Border"> |
|||
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlHighlightBaseMediumBrush}" /> |
|||
<Style Selector="Expander /template/ ToggleButton#ExpanderHeader:pressed"> |
|||
<Setter Property="RenderTransform" Value="{x:Null}" /> |
|||
</Style> |
|||
<Style Selector="Expander:down:expanded /template/ ToggleButton#PART_toggle /template/ Path"> |
|||
<Setter Property="RenderTransform"> |
|||
<RotateTransform Angle="90" /> |
|||
</Setter> |
|||
|
|||
<Style Selector="Expander:left /template/ ToggleButton#ExpanderHeader, Expander:right /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="VerticalAlignment" Value="Stretch" /> |
|||
</Style> |
|||
<Style Selector="Expander:up:expanded /template/ ToggleButton#PART_toggle /template/ Path"> |
|||
<Setter Property="RenderTransform"> |
|||
<RotateTransform Angle="-90" /> |
|||
</Setter> |
|||
|
|||
|
|||
<Style Selector="Expander /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="Background" Value="{TemplateBinding Background}" /> |
|||
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" /> |
|||
<Setter Property="BorderThickness" Value="{TemplateBinding BorderThickness}" /> |
|||
</Style> |
|||
<Style Selector="Expander:left:expanded /template/ ToggleButton#PART_toggle /template/ Path"> |
|||
<Setter Property="RenderTransform"> |
|||
<RotateTransform Angle="180" /> |
|||
</Setter> |
|||
|
|||
<Style Selector="Expander:not(:expanded) /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
|||
</Style> |
|||
<Style Selector="Expander:right /template/ ToggleButton#PART_toggle /template/ Path"> |
|||
<Setter Property="RenderTransform"> |
|||
<RotateTransform Angle="180" /> |
|||
</Setter> |
|||
<Style Selector="Expander:expanded:up /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource BottomCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:right:expanded /template/ ToggleButton#PART_toggle /template/ Path"> |
|||
<Setter Property="RenderTransform"> |
|||
<RotateTransform Angle="0" /> |
|||
</Setter> |
|||
<Style Selector="Expander:expanded:up /template/ Border#ExpanderContent"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:down /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:down /template/ Border#ExpanderContent"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource BottomCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:left /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:left /template/ Border#ExpanderContent"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource LeftCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:right /template/ ToggleButton#ExpanderHeader /template/ Border#ToggleButtonBackground"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource LeftCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
<Style Selector="Expander:expanded:right /template/ Border#ExpanderContent"> |
|||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Expander:left /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="DockPanel.Dock" Value="Right" /> |
|||
</Style> |
|||
<Style Selector="Expander:up /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="DockPanel.Dock" Value="Bottom" /> |
|||
</Style> |
|||
<Style Selector="Expander:right /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="DockPanel.Dock" Value="Left" /> |
|||
</Style> |
|||
<Style Selector="Expander:down /template/ ToggleButton#ExpanderHeader"> |
|||
<Setter Property="DockPanel.Dock" Value="Top" /> |
|||
</Style> |
|||
|
|||
|
|||
<Style Selector="Expander:expanded /template/ ToggleButton#ExpanderHeader /template/ Border#ExpandCollapseChevronBorder"> |
|||
<Style.Animations> |
|||
<Animation FillMode="Both" Duration="0:0:0.0625"> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="RotateTransform.Angle" Value="180" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Expander:not(:expanded) /template/ ToggleButton#ExpanderHeader /template/ Border#ExpandCollapseChevronBorder"> |
|||
<Style.Animations> |
|||
<Animation FillMode="Both" Duration="0:0:0.0625"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="RotateTransform.Angle" Value="180" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="RotateTransform.Angle" Value="0" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
|
|||
<Style Selector="Expander:left /template/ ToggleButton#ExpanderHeader /template/ Path#ExpandCollapseChevron"> |
|||
<Setter Property="Data" Value="M 7 0 L 0 7 L 7 14" /> |
|||
</Style> |
|||
<Style Selector="Expander:up /template/ ToggleButton#ExpanderHeader /template/ Path#ExpandCollapseChevron"> |
|||
<Setter Property="Data" Value="M 0 7 L 7 0 L 14 7" /> |
|||
</Style> |
|||
<Style Selector="Expander:right /template/ ToggleButton#ExpanderHeader /template/ Path#ExpandCollapseChevron"> |
|||
<Setter Property="Data" Value="M 0 0 L 7 7 L 0 14" /> |
|||
</Style> |
|||
<Style Selector="Expander:down /template/ ToggleButton#ExpanderHeader /template/ Path#ExpandCollapseChevron"> |
|||
<Setter Property="Data" Value="M 0 0 L 7 7 L 14 0" /> |
|||
</Style> |
|||
|
|||
|
|||
<Style Selector="Expander:left /template/ Border#ExpanderContent"> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderDropdownLeftBorderThickness}" /> |
|||
</Style> |
|||
<Style Selector="Expander:up /template/ Border#ExpanderContent"> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderDropdownUpBorderThickness}" /> |
|||
</Style> |
|||
<Style Selector="Expander:right /template/ Border#ExpanderContent"> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderDropdownRightBorderThickness}" /> |
|||
</Style> |
|||
<Style Selector="Expander:down /template/ Border#ExpanderContent"> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderDropdownDownBorderThickness}" /> |
|||
</Style> |
|||
</Styles> |
|||
|
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
|
|||
using Avalonia.Animation.Animators; |
|||
using Avalonia.Media; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Transition class that handles <see cref="AvaloniaProperty"/> with <see cref="BoxShadows"/> type.
|
|||
/// </summary>
|
|||
public class BoxShadowsTransition : Transition<BoxShadows> |
|||
{ |
|||
private static readonly BoxShadowsAnimator s_animator = new BoxShadowsAnimator(); |
|||
|
|||
/// <inheritdocs/>
|
|||
public override IObservable<BoxShadows> DoTransition(IObservable<double> progress, BoxShadows oldValue, BoxShadows newValue) |
|||
{ |
|||
return progress |
|||
.Select(progress => s_animator.Interpolate(Easing.Ease(progress), oldValue, newValue)); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue