Fixed issue where we couldn't enter a space into textbox within SettingsExpander
This commit is contained in:
@@ -8,14 +8,15 @@ public class PersonPictureColourGenerator
|
|||||||
{
|
{
|
||||||
private readonly string[] colours =
|
private readonly string[] colours =
|
||||||
[
|
[
|
||||||
"#FFB900", "#E81123", "#0078D7", "#0099BC", "#7A7574",
|
"#FFB900", "#FF8C00", "#F7630C", "#CA5010", "#DA3B01", "#EF6950", "#D13438", "#FF4343",
|
||||||
"#767676", "#FF8C00", "#E81123", "#0063B1", "#2D7D9A",
|
"#E74856", "#E81123", "#EA005E", "#C30052", "#E3008C", "#BF0077", "#C239B3", "#9A0089",
|
||||||
"#5D5A58", "#4C4A48", "#F7630C", "#EA005E", "#8E8CD8",
|
"#0078D7", "#0063B1", "#8E8CD8", "#6B69D6", "#8764B8", "#744DA9", "#B146C2", "#881798",
|
||||||
"#0078D7", "#68768A", "#69797E", "#CA5010", "#C30052",
|
"#0099BC", "#2D7D9A", "#00B7C3", "#038387", "#00B294", "#018574", "#00CC6A", "#10893E",
|
||||||
"#6B69D6", "#038387", "#515C6B", "#4A5459", "#DA3B01",
|
"#7A7574", "#5D5A58", "#68768A", "#515C6B", "#567C73", "#486860", "#498205", "#107C10",
|
||||||
"#E3008C", "#8764B8", "#00B294", "#567C73", "#647C64"
|
"#767676", "#4C4A48", "#69797E", "#4A5459", "#647C64", "#525E54", "#847545", "#7E735F"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public Color GenerateColour(string input)
|
public Color GenerateColour(string input)
|
||||||
{
|
{
|
||||||
byte[] hashBytes = GetHash(input);
|
byte[] hashBytes = GetHash(input);
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="using:Toolkit.UI.Controls.Avalonia"
|
||||||
|
xmlns:ui="using:FluentAvalonia.UI.Controls">
|
||||||
|
<ControlTheme x:Key="SettingsExpanderExpanderStyle" TargetType="Expander">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource SettingsExpanderMinHeight}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderContentBorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderContentDownBorderThickness}" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<StackPanel>
|
||||||
|
<controls:SettingsExpanderToggleButton
|
||||||
|
Name="ToggleButton"
|
||||||
|
MinHeight="{TemplateBinding MinHeight}"
|
||||||
|
Content="{TemplateBinding Header}"
|
||||||
|
IsChecked="{TemplateBinding IsExpanded,
|
||||||
|
Mode=TwoWay}"
|
||||||
|
IsEnabled="{TemplateBinding IsEnabled}"
|
||||||
|
Theme="{StaticResource SettingsExpanderToggleButtonStyle}" />
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Name="ExpanderContent"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BackgroundSizing="InnerBorderEdge"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius,
|
||||||
|
Converter={StaticResource BottomCornerRadiusFilterConverter}}"
|
||||||
|
IsVisible="False">
|
||||||
|
<ContentPresenter
|
||||||
|
Name="PART_ContentPresenter"
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
IsVisible="{TemplateBinding IsExpanded}" />
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
<Style Selector="^:expanded /template/ Border#ExpanderContent">
|
||||||
|
<Setter Property="IsVisible" Value="True" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
<ControlTheme x:Key="{x:Type ui:SettingsExpander}" TargetType="ui:SettingsExpander">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource ExpanderBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderHeaderBorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ExpanderHeaderBorderThickness}" />
|
||||||
|
<Setter Property="Padding" Value="{DynamicResource SettingsExpanderPadding}" />
|
||||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource SettingsExpanderMinHeight}" />
|
||||||
|
<Setter Property="ItemsPanel">
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Spacing="1" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Expander
|
||||||
|
Name="Expander"
|
||||||
|
IsExpanded="{TemplateBinding IsExpanded,
|
||||||
|
Mode=TwoWay}"
|
||||||
|
Theme="{StaticResource SettingsExpanderExpanderStyle}">
|
||||||
|
<Expander.Header>
|
||||||
|
<ui:SettingsExpanderItem
|
||||||
|
Name="ContentHost"
|
||||||
|
Padding="{DynamicResource SettingsExpanderPadding}"
|
||||||
|
ActionIconSource="{TemplateBinding ActionIconSource}"
|
||||||
|
Background="Transparent"
|
||||||
|
Content="{TemplateBinding Header}"
|
||||||
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||||
|
Description="{TemplateBinding Description}"
|
||||||
|
Footer="{TemplateBinding Footer}"
|
||||||
|
FooterTemplate="{TemplateBinding FooterTemplate}"
|
||||||
|
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>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
|
||||||
|
|
||||||
public class SettingsExpander : FluentAvalonia.UI.Controls.SettingsExpander
|
public class SettingsExpander : FluentAvalonia.UI.Controls.SettingsExpander
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Avalonia.Controls.Primitives;
|
||||||
|
using Avalonia.Input;
|
||||||
|
|
||||||
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
|
public class SettingsExpanderToggleButton :
|
||||||
|
ToggleButton
|
||||||
|
{
|
||||||
|
protected override void OnKeyDown(KeyEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.Key is not Key.Space)
|
||||||
|
{
|
||||||
|
base.OnKeyDown(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<MergeResourceInclude Source="../CarouselView/CarouselView.axaml" />
|
<MergeResourceInclude Source="../CarouselView/CarouselView.axaml" />
|
||||||
<MergeResourceInclude Source="../PersonPicture/PersonPicture.axaml" />
|
<MergeResourceInclude Source="../PersonPicture/PersonPicture.axaml" />
|
||||||
|
<MergeResourceInclude Source="../SettingsExpander/SettingsExpander.axaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Styles.Resources>
|
</Styles.Resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user