now with less flickering
This commit is contained in:
@@ -138,6 +138,10 @@ public class FrameHandler :
|
|||||||
{
|
{
|
||||||
switch ($"{transition}")
|
switch ($"{transition}")
|
||||||
{
|
{
|
||||||
|
case "Suppress":
|
||||||
|
navigationOptions.TransitionInfoOverride =
|
||||||
|
new SuppressNavigationTransitionInfo();
|
||||||
|
break;
|
||||||
case "FromLeft":
|
case "FromLeft":
|
||||||
case "FromRight":
|
case "FromRight":
|
||||||
case "FromTop":
|
case "FromTop":
|
||||||
|
|||||||
@@ -4,6 +4,75 @@
|
|||||||
xmlns:controls="using:Toolkit.UI.Controls.Avalonia"
|
xmlns:controls="using:Toolkit.UI.Controls.Avalonia"
|
||||||
xmlns:ui="using:FluentAvalonia.UI.Controls">
|
xmlns:ui="using:FluentAvalonia.UI.Controls">
|
||||||
<Thickness x:Key="SettingsExpanderItemBottomFooterMargin">0 4 0 0</Thickness>
|
<Thickness x:Key="SettingsExpanderItemBottomFooterMargin">0 4 0 0</Thickness>
|
||||||
|
<ControlTheme x:Key="SettingsExpanderToggleButtonStyle" TargetType="controls:SettingsExpanderToggleButton">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ExpanderHeaderBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderHeaderBorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderHeaderBorderThickness}" />
|
||||||
|
<Setter Property="Padding" Value="0" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
|
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Border
|
||||||
|
Name="Root"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<Border.Transitions>
|
||||||
|
<Transitions>
|
||||||
|
<BrushTransition Property="Background" Duration="00:00:00.083" />
|
||||||
|
<BrushTransition Property="BorderBrush" Duration="00:00:00.083" />
|
||||||
|
</Transitions>
|
||||||
|
</Border.Transitions>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<ContentPresenter Content="{TemplateBinding Content}" />
|
||||||
|
<ui:SymbolIcon
|
||||||
|
Name="ExpandCollapseChevron"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="{DynamicResource SettingsExpanderExpandCollapseChevronMargin}"
|
||||||
|
FontSize="18"
|
||||||
|
Foreground="{DynamicResource ExpanderChevronForeground}"
|
||||||
|
IsVisible="{TemplateBinding IsToggleable}"
|
||||||
|
RenderTransform="none"
|
||||||
|
Symbol="ChevronDown" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^:allowClick">
|
||||||
|
<Style Selector="^:pointerover /template/ Border#Root">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ Border#Root">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ControlFillColorTertiaryBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||||
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:disabled /template/ Border#Root">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||||
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:checked">
|
||||||
|
<Style Selector="^ /template/ ui|SymbolIcon#ExpandCollapseChevron">
|
||||||
|
<Setter Property="RenderTransform" Value="rotate(180deg)" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:not(:empty) /template/ Border#Root">
|
||||||
|
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource TopCornerRadiusFilterConverter}}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="SettingsExpanderExpanderStyle" TargetType="Expander">
|
<ControlTheme x:Key="SettingsExpanderExpanderStyle" TargetType="Expander">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="MinWidth" Value="0" />
|
<Setter Property="MinWidth" Value="0" />
|
||||||
@@ -21,6 +90,7 @@
|
|||||||
IsChecked="{TemplateBinding IsExpanded,
|
IsChecked="{TemplateBinding IsExpanded,
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
IsEnabled="{TemplateBinding IsEnabled}"
|
IsEnabled="{TemplateBinding IsEnabled}"
|
||||||
|
IsToggleable="{TemplateBinding Tag}"
|
||||||
Theme="{StaticResource SettingsExpanderToggleButtonStyle}" />
|
Theme="{StaticResource SettingsExpanderToggleButtonStyle}" />
|
||||||
<Border
|
<Border
|
||||||
Name="ExpanderContent"
|
Name="ExpanderContent"
|
||||||
@@ -65,6 +135,7 @@
|
|||||||
Name="Expander"
|
Name="Expander"
|
||||||
IsExpanded="{TemplateBinding IsExpanded,
|
IsExpanded="{TemplateBinding IsExpanded,
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
|
Tag="{TemplateBinding IsToggleable}"
|
||||||
Theme="{StaticResource SettingsExpanderExpanderStyle}">
|
Theme="{StaticResource SettingsExpanderExpanderStyle}">
|
||||||
<Expander.Header>
|
<Expander.Header>
|
||||||
<controls:SettingsExpanderItem
|
<controls:SettingsExpanderItem
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Controls.Templates;
|
using Avalonia.Controls.Templates;
|
||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
@@ -12,6 +14,9 @@ public class SettingsExpander :
|
|||||||
public static readonly StyledProperty<IDataTemplate> ActionTemplateProperty =
|
public static readonly StyledProperty<IDataTemplate> ActionTemplateProperty =
|
||||||
AvaloniaProperty.Register<SettingsExpander, IDataTemplate>(nameof(ActionTemplate));
|
AvaloniaProperty.Register<SettingsExpander, IDataTemplate>(nameof(ActionTemplate));
|
||||||
|
|
||||||
|
public static readonly StyledProperty<bool> IsToggleableProperty =
|
||||||
|
AvaloniaProperty.Register<SettingsExpander, bool>(nameof(IsToggleable));
|
||||||
|
|
||||||
public object Action
|
public object Action
|
||||||
{
|
{
|
||||||
get => GetValue(ActionProperty);
|
get => GetValue(ActionProperty);
|
||||||
@@ -24,6 +29,13 @@ public class SettingsExpander :
|
|||||||
set => SetValue(ActionTemplateProperty, value);
|
set => SetValue(ActionTemplateProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsToggleable
|
||||||
|
{
|
||||||
|
get => GetValue(IsToggleableProperty);
|
||||||
|
set => SetValue(IsToggleableProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override Type StyleKeyOverride =>
|
protected override Type StyleKeyOverride =>
|
||||||
typeof(SettingsExpander);
|
typeof(SettingsExpander);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Avalonia.Controls.Primitives;
|
using Avalonia;
|
||||||
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
@@ -6,6 +7,15 @@ namespace Toolkit.UI.Controls.Avalonia;
|
|||||||
public class SettingsExpanderToggleButton :
|
public class SettingsExpanderToggleButton :
|
||||||
ToggleButton
|
ToggleButton
|
||||||
{
|
{
|
||||||
|
public static readonly StyledProperty<bool> IsToggleableProperty =
|
||||||
|
AvaloniaProperty.Register<SettingsExpanderToggleButton, bool>(nameof(IsToggleable));
|
||||||
|
|
||||||
|
public object IsToggleable
|
||||||
|
{
|
||||||
|
get => GetValue(IsToggleableProperty);
|
||||||
|
set => SetValue(IsToggleableProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs args)
|
protected override void OnKeyDown(KeyEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Key is not Key.Space)
|
if (args.Key is not Key.Space)
|
||||||
|
|||||||
Reference in New Issue
Block a user