Added Action content to SettingsExpander
This commit is contained in:
@@ -6,11 +6,3 @@ public class NavigationViewItem :
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.NavigationViewItem);
|
||||
}
|
||||
|
||||
|
||||
public class NavigationViewItemSeparator :
|
||||
FluentAvalonia.UI.Controls.NavigationViewItemSeparator
|
||||
{
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.NavigationViewItemSeparator);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class NavigationViewItemSeparator :
|
||||
FluentAvalonia.UI.Controls.NavigationViewItemSeparator
|
||||
{
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.NavigationViewItemSeparator);
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
Mode=TwoWay}"
|
||||
IsEnabled="{TemplateBinding IsEnabled}"
|
||||
Theme="{StaticResource SettingsExpanderToggleButtonStyle}" />
|
||||
|
||||
<Border
|
||||
Name="ExpanderContent"
|
||||
Background="{TemplateBinding Background}"
|
||||
@@ -48,7 +47,7 @@
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="{x:Type ui:SettingsExpander}" TargetType="ui:SettingsExpander">
|
||||
<ControlTheme x:Key="{x:Type controls:SettingsExpander}" TargetType="controls:SettingsExpander">
|
||||
<Setter Property="Background" Value="{DynamicResource ExpanderBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderHeaderBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderHeaderBorderThickness}" />
|
||||
@@ -68,10 +67,11 @@
|
||||
Mode=TwoWay}"
|
||||
Theme="{StaticResource SettingsExpanderExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<ui:SettingsExpanderItem
|
||||
<controls:SettingsExpanderItem
|
||||
Name="ContentHost"
|
||||
Padding="{DynamicResource SettingsExpanderPadding}"
|
||||
ActionIconSource="{TemplateBinding ActionIconSource}"
|
||||
ActionTemplate="{TemplateBinding ActionTemplate}"
|
||||
Background="Transparent"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
@@ -81,14 +81,158 @@
|
||||
IconSource="{TemplateBinding IconSource}"
|
||||
IsClickEnabled="{TemplateBinding IsClickEnabled}" />
|
||||
</Expander.Header>
|
||||
|
||||
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:empty /template/ ItemsPresenter#ItemsHost">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="{x:Type controls:SettingsExpanderItem}" TargetType="controls:SettingsExpanderItem">
|
||||
<Setter Property="Background" Value="{DynamicResource ExpanderHeaderBackground}" />
|
||||
<Setter Property="Padding" Value="{DynamicResource SettingsExpanderItemPadding}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource SettingsExpanderItemMinHeight}" />
|
||||
<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}">
|
||||
<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,Auto,Auto" RowDefinitions="*,Auto">
|
||||
<Viewbox
|
||||
Name="IconHost"
|
||||
Width="{DynamicResource SettingsExpanderItemIconSize}"
|
||||
Height="{DynamicResource SettingsExpanderItemIconSize}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="False">
|
||||
<ContentPresenter Name="IconPresenter" Content="{Binding TemplateSettings.Icon, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Viewbox>
|
||||
<StackPanel
|
||||
Name="HeaderRegion"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="Center">
|
||||
<ContentPresenter
|
||||
Name="ContentPresenter"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
IsVisible="False" />
|
||||
<TextBlock
|
||||
Name="DescriptionText"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsVisible="False"
|
||||
Text="{TemplateBinding Description}"
|
||||
TextWrapping="Wrap"
|
||||
Theme="{StaticResource CaptionTextBlockStyle}" />
|
||||
</StackPanel>
|
||||
<ContentPresenter
|
||||
Name="FooterPresenter"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="1"
|
||||
Margin="{DynamicResource SettingsExpanderItemFooterMargin}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Footer}"
|
||||
ContentTemplate="{TemplateBinding FooterTemplate}"
|
||||
IsVisible="False" />
|
||||
<ContentPresenter
|
||||
Name="ActionPresenter"
|
||||
Grid.Column="2"
|
||||
Content="{TemplateBinding Action}"
|
||||
ContentTemplate="{TemplateBinding ActionTemplate}" />
|
||||
<Button Grid.Column="2">dsfdsfsdfs</Button>
|
||||
<Viewbox
|
||||
Name="ActionIconHost"
|
||||
Grid.Column="3"
|
||||
Width="{DynamicResource SettingsExpanderItemActionIconSize}"
|
||||
Height="{DynamicResource SettingsExpanderItemActionIconSize}"
|
||||
IsVisible="False">
|
||||
<ContentPresenter Name="ExpandChevronActionIconContainer" Content="{Binding TemplateSettings.ActionIcon, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:empty /template/ ItemsPresenter#ItemsHost">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:nth-last-child(1) /template/ Border#Root">
|
||||
<Setter Property="CornerRadius" Value="{Binding Source={StaticResource ControlCornerRadius}, Converter={StaticResource BottomCornerRadiusFilterConverter}}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:footer /template/ ContentPresenter#FooterPresenter">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:footerBottom /template/ ContentPresenter#FooterPresenter">
|
||||
<Setter Property="Grid.Row" Value="1" />
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Grid.ColumnSpan" Value="3" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemBottomFooterMargin}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:actionIcon /template/ Viewbox#ActionIconHost">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:content /template/ ContentPresenter#ContentPresenter">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:description /template/ TextBlock#DescriptionText">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^:icon">
|
||||
<Style Selector="^ /template/ Viewbox#IconHost">
|
||||
<Setter Property="IsVisible" Value="True" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ StackPanel#HeaderRegion">
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemContentMargin}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:iconPlaceholder">
|
||||
<Style Selector="^ /template/ StackPanel#HeaderRegion">
|
||||
<Setter Property="Margin" Value="{DynamicResource SettingsExpanderItemContentMargin}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:allowClick">
|
||||
<Style Selector="^:pointerover /template/ Border#Root">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
</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">
|
||||
<Style Selector="^ /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="^ /template/ TextBlock#DescriptionText">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Templates;
|
||||
|
||||
public class SettingsExpander : FluentAvalonia.UI.Controls.SettingsExpander
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class SettingsExpander :
|
||||
FluentAvalonia.UI.Controls.SettingsExpander
|
||||
{
|
||||
public static readonly StyledProperty<object> ActionProperty =
|
||||
AvaloniaProperty.Register<SettingsExpander, object>(nameof(Action));
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate> ActionTemplateProperty =
|
||||
AvaloniaProperty.Register<SettingsExpander, IDataTemplate>(nameof(ActionTemplate));
|
||||
|
||||
public object Action
|
||||
{
|
||||
get => GetValue(ActionProperty);
|
||||
set => SetValue(ActionProperty, value);
|
||||
}
|
||||
|
||||
public IDataTemplate ActionTemplate
|
||||
{
|
||||
get => GetValue(ActionTemplateProperty);
|
||||
set => SetValue(ActionTemplateProperty, value);
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.SettingsExpander);
|
||||
}
|
||||
typeof(SettingsExpander);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Templates;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class SettingsExpanderItem :
|
||||
FluentAvalonia.UI.Controls.SettingsExpanderItem
|
||||
{
|
||||
public static readonly StyledProperty<object> ActionProperty =
|
||||
AvaloniaProperty.Register<SettingsExpanderItem, object>(nameof(Action));
|
||||
|
||||
public static readonly StyledProperty<IDataTemplate> ActionTemplateProperty =
|
||||
AvaloniaProperty.Register<SettingsExpanderItem, IDataTemplate>(nameof(ActionTemplate));
|
||||
|
||||
public object Action
|
||||
{
|
||||
get => GetValue(ActionProperty);
|
||||
set => SetValue(ActionProperty, value);
|
||||
}
|
||||
|
||||
public IDataTemplate ActionTemplate
|
||||
{
|
||||
get => GetValue(ActionTemplateProperty);
|
||||
set => SetValue(ActionTemplateProperty, value);
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(SettingsExpanderItem);
|
||||
}
|
||||
Reference in New Issue
Block a user