Codemaid
This commit is contained in:
@@ -5,7 +5,8 @@ using Avalonia.Media;
|
||||
using Path = Avalonia.Controls.Shapes.Path;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
public class ContentBadge :
|
||||
|
||||
public class ContentBadge :
|
||||
ContentControl
|
||||
{
|
||||
public static readonly StyledProperty<string> BadgePathProperty =
|
||||
@@ -95,14 +96,17 @@ public class ContentBadge :
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
break;
|
||||
|
||||
case ContentBadgePlacement.TopRight:
|
||||
offsetX = backgroundWidth - scaledWidth;
|
||||
offsetY = 0;
|
||||
break;
|
||||
|
||||
case ContentBadgePlacement.BottomLeft:
|
||||
offsetX = 0;
|
||||
offsetY = backgroundHeight - scaledHeight;
|
||||
break;
|
||||
|
||||
case ContentBadgePlacement.BottomRight:
|
||||
offsetX = backgroundWidth - scaledWidth;
|
||||
offsetY = backgroundHeight - scaledHeight;
|
||||
@@ -154,5 +158,4 @@ public class ContentBadge :
|
||||
base.OnSizeChanged(args);
|
||||
UpdateBadge();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,5 +6,4 @@ public enum ContentBadgePlacement
|
||||
TopRight,
|
||||
BottomLeft,
|
||||
BottomRight
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,4 +5,4 @@ public class NavigationViewItem :
|
||||
{
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.NavigationViewItem);
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,4 @@ public class NavigationViewItemSeparator :
|
||||
{
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(FluentAvalonia.UI.Controls.NavigationViewItemSeparator);
|
||||
}
|
||||
}
|
||||
@@ -75,15 +75,14 @@
|
||||
BadgePath="{TemplateBinding BadgePath}"
|
||||
BadgePlacement="{TemplateBinding BadgePlacement}"
|
||||
BadgeSize="{TemplateBinding BadgeSize}"
|
||||
Foreground="Red"
|
||||
Foreground="{TemplateBinding BadgeBrush}"
|
||||
IsBadgeVisible="{TemplateBinding IsBadgeVisible}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
/>
|
||||
Content="{TemplateBinding Content}" />
|
||||
<Border
|
||||
Name="SelectionIndicator"
|
||||
BorderBrush="{DynamicResource AccentFillColorDefaultBrush}"
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Collections.Specialized;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class Overflow :
|
||||
public class Overflow :
|
||||
TemplatedControl
|
||||
{
|
||||
public static readonly StyledProperty<ITemplate<Panel?>> ItemsPanelProperty =
|
||||
@@ -29,7 +29,6 @@ public class Overflow :
|
||||
private static readonly StyledProperty<OverflowTemplateSettings> TemplateSettingsProperty =
|
||||
AvaloniaProperty.Register<Overflow, OverflowTemplateSettings>(nameof(TemplateSettings));
|
||||
|
||||
|
||||
private readonly ObservableCollection<object> primaryCollection = [];
|
||||
|
||||
private readonly ObservableCollection<object> secondaryCollection = [];
|
||||
@@ -60,6 +59,7 @@ public class Overflow :
|
||||
get => GetValue(ItemsSourceProperty);
|
||||
set => SetValue(ItemsSourceProperty, value);
|
||||
}
|
||||
|
||||
[InheritDataTypeFromItems(nameof(ItemsSource))]
|
||||
public IDataTemplate? ItemTemplate
|
||||
{
|
||||
@@ -146,6 +146,7 @@ public class Overflow :
|
||||
object? selection = args.GetNewValue<object>();
|
||||
SetValue(SelectedItemProperty, selection);
|
||||
}
|
||||
|
||||
private void OnSourceCollectionChanged(object? sender,
|
||||
NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
@@ -306,5 +307,4 @@ public class Overflow :
|
||||
TemplateSettings.SetValue(OverflowTemplateSettings.SecondarySelectionProperty, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class OverflowItem :
|
||||
public class OverflowItem :
|
||||
ListBoxItem
|
||||
{
|
||||
public static readonly StyledProperty<double> BadgeSizeProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, double>(nameof(BadgeSize), 14);
|
||||
|
||||
public static readonly StyledProperty<bool> IsBadgeVisibleProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, bool>(nameof(IsBadgeVisible), true);
|
||||
public static readonly StyledProperty<IBrush> BadgeBrushProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, IBrush>(nameof(BadgeBrush));
|
||||
|
||||
public static readonly StyledProperty<string> BadgePathProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, string>(nameof(BadgePath));
|
||||
@@ -18,6 +16,18 @@ public class OverflowItem :
|
||||
public static readonly StyledProperty<ContentBadgePlacement> BadgePlacementProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, ContentBadgePlacement>(nameof(BadgePlacement), ContentBadgePlacement.BottomRight);
|
||||
|
||||
public static readonly StyledProperty<double> BadgeSizeProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, double>(nameof(BadgeSize), 14);
|
||||
|
||||
public static readonly StyledProperty<bool> IsBadgeVisibleProperty =
|
||||
AvaloniaProperty.Register<OverflowItem, bool>(nameof(IsBadgeVisible), true);
|
||||
|
||||
public IBrush BadgeBrush
|
||||
{
|
||||
get => GetValue(BadgeBrushProperty);
|
||||
set => SetValue(BadgeBrushProperty, value);
|
||||
}
|
||||
|
||||
public string BadgePath
|
||||
{
|
||||
get => GetValue(BadgePathProperty);
|
||||
@@ -41,5 +51,4 @@ public class OverflowItem :
|
||||
get => GetValue(IsBadgeVisibleProperty);
|
||||
set => SetValue(IsBadgeVisibleProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,5 +45,4 @@ public class OverflowTemplateSettings :
|
||||
get => GetValue(SecondarySelectionProperty);
|
||||
set => SetValue(SecondarySelectionProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,5 +39,4 @@ public class TemplateListBox :
|
||||
recycleKey = DefaultRecycleKey;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ using Avalonia.Media.Imaging;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
|
||||
public class PersonPicture : TemplatedControl
|
||||
{
|
||||
public static readonly StyledProperty<string> BadgeGlyphProperty =
|
||||
|
||||
@@ -8,15 +8,56 @@ public class PersonPictureColourGenerator
|
||||
{
|
||||
private readonly string[] colours =
|
||||
[
|
||||
"#FFB900", "#FF8C00", "#F7630C", "#CA5010", "#DA3B01", "#EF6950", "#D13438", "#FF4343",
|
||||
"#E74856", "#E81123", "#EA005E", "#C30052", "#E3008C", "#BF0077", "#C239B3", "#9A0089",
|
||||
"#0078D7", "#0063B1", "#8E8CD8", "#6B69D6", "#8764B8", "#744DA9", "#B146C2", "#881798",
|
||||
"#0099BC", "#2D7D9A", "#00B7C3", "#038387", "#00B294", "#018574", "#00CC6A", "#10893E",
|
||||
"#7A7574", "#5D5A58", "#68768A", "#515C6B", "#567C73", "#486860", "#498205", "#107C10",
|
||||
"#767676", "#4C4A48", "#69797E", "#4A5459", "#647C64", "#525E54", "#847545", "#7E735F"
|
||||
"#FFB900",
|
||||
"#FF8C00",
|
||||
"#F7630C",
|
||||
"#CA5010",
|
||||
"#DA3B01",
|
||||
"#EF6950",
|
||||
"#D13438",
|
||||
"#FF4343",
|
||||
"#E74856",
|
||||
"#E81123",
|
||||
"#EA005E",
|
||||
"#C30052",
|
||||
"#E3008C",
|
||||
"#BF0077",
|
||||
"#C239B3",
|
||||
"#9A0089",
|
||||
"#0078D7",
|
||||
"#0063B1",
|
||||
"#8E8CD8",
|
||||
"#6B69D6",
|
||||
"#8764B8",
|
||||
"#744DA9",
|
||||
"#B146C2",
|
||||
"#881798",
|
||||
"#0099BC",
|
||||
"#2D7D9A",
|
||||
"#00B7C3",
|
||||
"#038387",
|
||||
"#00B294",
|
||||
"#018574",
|
||||
"#00CC6A",
|
||||
"#10893E",
|
||||
"#7A7574",
|
||||
"#5D5A58",
|
||||
"#68768A",
|
||||
"#515C6B",
|
||||
"#567C73",
|
||||
"#486860",
|
||||
"#498205",
|
||||
"#107C10",
|
||||
"#767676",
|
||||
"#4C4A48",
|
||||
"#69797E",
|
||||
"#4A5459",
|
||||
"#647C64",
|
||||
"#525E54",
|
||||
"#847545",
|
||||
"#7E735F"
|
||||
];
|
||||
|
||||
|
||||
public Color GenerateColour(string input)
|
||||
{
|
||||
byte[] hashBytes = GetHash(input);
|
||||
@@ -42,4 +83,4 @@ public class PersonPictureColourGenerator
|
||||
|
||||
return Color.FromArgb(a, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ public class SettingsExpander :
|
||||
set => SetValue(IsToggleableProperty, value);
|
||||
}
|
||||
|
||||
|
||||
protected override Type StyleKeyOverride =>
|
||||
typeof(SettingsExpander);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using Avalonia.Input;
|
||||
|
||||
namespace Toolkit.UI.Controls.Avalonia;
|
||||
|
||||
public class SettingsExpanderToggleButton :
|
||||
public class SettingsExpanderToggleButton :
|
||||
ToggleButton
|
||||
{
|
||||
public static readonly StyledProperty<bool> IsToggleableProperty =
|
||||
|
||||
Reference in New Issue
Block a user