This commit is contained in:
TheXamlGuy
2024-07-17 21:43:58 +01:00
parent efd00ff81a
commit 93c7a43ab4
75 changed files with 231 additions and 183 deletions
@@ -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;
}
}
}