Codemaid
This commit is contained in:
@@ -4,7 +4,7 @@ using Toolkit.UI.Controls.Avalonia;
|
|||||||
|
|
||||||
namespace Toolkit.Avalonia;
|
namespace Toolkit.Avalonia;
|
||||||
|
|
||||||
public class ContentDialogHandler(IDispatcher dispatcher) :
|
public class ContentDialogHandler :
|
||||||
INotificationHandler<NavigateEventArgs<ContentDialog>>
|
INotificationHandler<NavigateEventArgs<ContentDialog>>
|
||||||
{
|
{
|
||||||
public async Task Handle(NavigateEventArgs<ContentDialog> args)
|
public async Task Handle(NavigateEventArgs<ContentDialog> args)
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ public class FrameHandler :
|
|||||||
navigationOptions.TransitionInfoOverride =
|
navigationOptions.TransitionInfoOverride =
|
||||||
new SuppressNavigationTransitionInfo();
|
new SuppressNavigationTransitionInfo();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "FromLeft":
|
case "FromLeft":
|
||||||
case "FromRight":
|
case "FromRight":
|
||||||
case "FromTop":
|
case "FromTop":
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ public class Cache<TKey, TValue>(IComparer<TKey> comparer) :
|
|||||||
value = default;
|
value = default;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class KeyValuePairComparer<TK, TV>(IComparer<TK> comparer) :
|
private class KeyValuePairComparer<TK, TV>(IComparer<TK> comparer) :
|
||||||
IComparer<KeyValuePair<TK, TV>>
|
IComparer<KeyValuePair<TK, TV>>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Toolkit.Foundation;
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
|
|
||||||
public class Component :
|
public class Component :
|
||||||
IComponent
|
IComponent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Toolkit.Foundation
|
||||||
namespace Toolkit.Foundation
|
|
||||||
{
|
{
|
||||||
public interface IContentFactory
|
public interface IContentFactory
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Toolkit.Foundation;
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
public static class IServiceCollectionExtensions
|
public static class IServiceCollectionExtensions
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddCache<TKey, TValue>(this IServiceCollection services)
|
public static IServiceCollection AddCache<TKey, TValue>(this IServiceCollection services)
|
||||||
|
|||||||
@@ -160,5 +160,4 @@ public class Mediator(IHandlerProvider handlerProvider,
|
|||||||
|
|
||||||
return handlers.SelectMany(entry => entry.Value).ToList();
|
return handlers.SelectMany(entry => entry.Value).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
public static class MediatorExtensions
|
public static class MediatorExtensions
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
namespace Toolkit.Foundation;
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||||
public class NotificationAttribute(Type type,
|
public class NotificationAttribute(Type type,
|
||||||
object key) : Attribute
|
object key) : Attribute
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public partial class Observable(IServiceProvider provider,
|
|||||||
|
|
||||||
public virtual void OnInitialize()
|
public virtual void OnInitialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
@@ -129,10 +128,9 @@ public partial class Observable<TValue> :
|
|||||||
|
|
||||||
protected virtual void OnValueChanged()
|
protected virtual void OnValueChanged()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnValueChanged(TValue? value) => OnValueChanged();
|
private partial void OnValueChanged(TValue? value) => OnValueChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Observable<TKey, TValue> :
|
public partial class Observable<TKey, TValue> :
|
||||||
@@ -160,8 +158,7 @@ public partial class Observable<TKey, TValue> :
|
|||||||
|
|
||||||
protected virtual void OnValueChanged()
|
protected virtual void OnValueChanged()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnValueChanged(TValue? value) => OnValueChanged();
|
private partial void OnValueChanged(TValue? value) => OnValueChanged();
|
||||||
}
|
}
|
||||||
@@ -181,6 +181,7 @@ public partial class ObservableCollection<TItem> :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NotifyCollectionChangedAction.Remove:
|
case NotifyCollectionChangedAction.Remove:
|
||||||
if (args.OldItems is not null)
|
if (args.OldItems is not null)
|
||||||
{
|
{
|
||||||
@@ -193,6 +194,7 @@ public partial class ObservableCollection<TItem> :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NotifyCollectionChangedAction.Reset:
|
case NotifyCollectionChangedAction.Reset:
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
@@ -263,7 +265,6 @@ public partial class ObservableCollection<TItem> :
|
|||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(item!);
|
Add(item!);
|
||||||
@@ -296,7 +297,6 @@ public partial class ObservableCollection<TItem> :
|
|||||||
Disposer.Dispose(item);
|
Disposer.Dispose(item);
|
||||||
Disposer.Remove(this, item);
|
Disposer.Remove(this, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearItems();
|
ClearItems();
|
||||||
@@ -501,7 +501,6 @@ public partial class ObservableCollection<TItem> :
|
|||||||
|
|
||||||
public virtual void OnInitialize()
|
public virtual void OnInitialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
@@ -722,7 +721,7 @@ public partial class ObservableCollection<TItem> :
|
|||||||
CollectionChanged?.Invoke(this, args);
|
CollectionChanged?.Invoke(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnIsActivatedChanged(bool value)
|
private partial void OnIsActivatedChanged(bool value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
@@ -734,7 +733,7 @@ public partial class ObservableCollection<TItem> :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnSelectedItemChanged(TItem? oldValue, TItem? newValue)
|
private partial void OnSelectedItemChanged(TItem? oldValue, TItem? newValue)
|
||||||
{
|
{
|
||||||
if (oldValue is ISelectable oldSelection)
|
if (oldValue is ISelectable oldSelection)
|
||||||
{
|
{
|
||||||
@@ -752,7 +751,6 @@ public partial class ObservableCollection<TItem> :
|
|||||||
|
|
||||||
protected virtual void OnSelectedItemChanged()
|
protected virtual void OnSelectedItemChanged()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSelection(TItem item)
|
private void UpdateSelection(TItem item)
|
||||||
@@ -786,17 +784,16 @@ public partial class ObservableCollection<TValue, TViewModel>(IServiceProvider p
|
|||||||
|
|
||||||
protected virtual void OnValueChanged()
|
protected virtual void OnValueChanged()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnValueChanged(TValue value) => OnValueChanged();
|
private partial void OnValueChanged(TValue value) => OnValueChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class ObservableCollection<TViewModel, TKey, TValue> :
|
public partial class ObservableCollection<TViewModel, TKey, TValue> :
|
||||||
ObservableCollection<TViewModel>
|
ObservableCollection<TViewModel>
|
||||||
where TViewModel : notnull, IDisposable
|
where TViewModel : notnull, IDisposable
|
||||||
where TKey : notnull
|
where TKey : notnull
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private TKey key;
|
private TKey key;
|
||||||
|
|
||||||
@@ -832,10 +829,9 @@ public partial class ObservableCollection<TViewModel, TKey, TValue> :
|
|||||||
|
|
||||||
protected virtual void OnValueChanged()
|
protected virtual void OnValueChanged()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnValueChanged(TValue value) => OnValueChanged();
|
private partial void OnValueChanged(TValue value) => OnValueChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObservableCollection :
|
public class ObservableCollection :
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public static class TupleExtensions
|
|||||||
(T3)Convert.ChangeType(parameters[2], typeof(T3)),
|
(T3)Convert.ChangeType(parameters[2], typeof(T3)),
|
||||||
(T4)Convert.ChangeType(parameters[3], typeof(T4))
|
(T4)Convert.ChangeType(parameters[3], typeof(T4))
|
||||||
);
|
);
|
||||||
|
|
||||||
public static (T1, T2, T3, T4, T5) CreateValueTuple<T1, T2, T3, T4, T5>(this object[] parameters) => (
|
public static (T1, T2, T3, T4, T5) CreateValueTuple<T1, T2, T3, T4, T5>(this object[] parameters) => (
|
||||||
(T1)Convert.ChangeType(parameters[0], typeof(T1)),
|
(T1)Convert.ChangeType(parameters[0], typeof(T1)),
|
||||||
(T2)Convert.ChangeType(parameters[1], typeof(T2)),
|
(T2)Convert.ChangeType(parameters[1], typeof(T2)),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class Validation(IValidatorCollection validators) :
|
|||||||
private readonly ValidationErrorCollection errors = [];
|
private readonly ValidationErrorCollection errors = [];
|
||||||
|
|
||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, string> Errors =>
|
public IReadOnlyDictionary<string, string> Errors =>
|
||||||
errors.AsReadOnly();
|
errors.AsReadOnly();
|
||||||
|
|
||||||
@@ -36,7 +37,6 @@ public class Validation(IValidatorCollection validators) :
|
|||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> Validate<TProperty>(Expression<Func<TProperty>> property,
|
public async Task<bool> Validate<TProperty>(Expression<Func<TProperty>> property,
|
||||||
ValidationRule[] rules)
|
ValidationRule[] rules)
|
||||||
{
|
{
|
||||||
@@ -109,11 +109,13 @@ public class Validation(IValidatorCollection validators) :
|
|||||||
OnPropertyChanged(nameof(Errors), null, null);
|
OnPropertyChanged(nameof(Errors), null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Clear()
|
private void Clear()
|
||||||
{
|
{
|
||||||
errors.Clear();
|
errors.Clear();
|
||||||
OnPropertyChanged(nameof(Errors), null, null);
|
OnPropertyChanged(nameof(Errors), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPropertyName<T>(Expression<Func<T>> expression)
|
private string GetPropertyName<T>(Expression<Func<T>> expression)
|
||||||
{
|
{
|
||||||
return expression.Body switch
|
return expression.Body switch
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Collections.Specialized;
|
using System.Collections;
|
||||||
using System.Collections;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Collections;
|
||||||
using System.Collections;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Toolkit.Foundation;
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ public partial class ValueViewModel<TValue>(IServiceProvider provider,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnValueChanged(TValue? value) => OnChanged(value);
|
private partial void OnValueChanged(TValue? value) => OnChanged(value);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using Avalonia.Metadata;
|
using Avalonia.Metadata;
|
||||||
|
|
||||||
namespace Toolkit.UI.Avalonia;
|
namespace Toolkit.UI.Avalonia;
|
||||||
|
|
||||||
public class ConditionalExpression :
|
public class ConditionalExpression :
|
||||||
AvaloniaObject,
|
AvaloniaObject,
|
||||||
ICondition
|
ICondition
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class InvokeNavigationViewItemAction :
|
|||||||
AvaloniaObject,
|
AvaloniaObject,
|
||||||
IAction
|
IAction
|
||||||
{
|
{
|
||||||
|
private int currentIndex;
|
||||||
|
|
||||||
public static readonly StyledProperty<int> SelectedIndexProperty =
|
public static readonly StyledProperty<int> SelectedIndexProperty =
|
||||||
AvaloniaProperty.Register<InvokeNavigationViewItemAction, int>(nameof(SelectedIndex), 0);
|
AvaloniaProperty.Register<InvokeNavigationViewItemAction, int>(nameof(SelectedIndex), 0);
|
||||||
|
|
||||||
@@ -30,6 +32,11 @@ public class InvokeNavigationViewItemAction :
|
|||||||
|
|
||||||
public object? Execute(object? sender, object? parameter)
|
public object? Execute(object? sender, object? parameter)
|
||||||
{
|
{
|
||||||
|
//if (SelectedIndex == currentIndex)
|
||||||
|
//{
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
if ((Target ?? sender) is NavigationViewItem navigationViewItem)
|
if ((Target ?? sender) is NavigationViewItem navigationViewItem)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Post(() =>
|
||||||
@@ -53,6 +60,7 @@ public class InvokeNavigationViewItemAction :
|
|||||||
if (collection is { Count: > 0 })
|
if (collection is { Count: > 0 })
|
||||||
{
|
{
|
||||||
navigationView.SetValue(NavigationView.SelectedItemProperty, collection[SelectedIndex]);
|
navigationView.SetValue(NavigationView.SelectedItemProperty, collection[SelectedIndex]);
|
||||||
|
currentIndex = SelectedIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -64,5 +72,4 @@ public class InvokeNavigationViewItemAction :
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Xaml.Interactivity;
|
using Avalonia.Xaml.Interactivity;
|
||||||
using Toolkit.Foundation;
|
using Toolkit.Foundation;
|
||||||
using Toolkit.UI.Controls.Avalonia;
|
|
||||||
|
|
||||||
namespace Toolkit.UI.Avalonia;
|
namespace Toolkit.UI.Avalonia;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Avalonia.Media;
|
|||||||
using Path = Avalonia.Controls.Shapes.Path;
|
using Path = Avalonia.Controls.Shapes.Path;
|
||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
public class ContentBadge :
|
public class ContentBadge :
|
||||||
ContentControl
|
ContentControl
|
||||||
{
|
{
|
||||||
@@ -95,14 +96,17 @@ public class ContentBadge :
|
|||||||
offsetX = 0;
|
offsetX = 0;
|
||||||
offsetY = 0;
|
offsetY = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ContentBadgePlacement.TopRight:
|
case ContentBadgePlacement.TopRight:
|
||||||
offsetX = backgroundWidth - scaledWidth;
|
offsetX = backgroundWidth - scaledWidth;
|
||||||
offsetY = 0;
|
offsetY = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ContentBadgePlacement.BottomLeft:
|
case ContentBadgePlacement.BottomLeft:
|
||||||
offsetX = 0;
|
offsetX = 0;
|
||||||
offsetY = backgroundHeight - scaledHeight;
|
offsetY = backgroundHeight - scaledHeight;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ContentBadgePlacement.BottomRight:
|
case ContentBadgePlacement.BottomRight:
|
||||||
offsetX = backgroundWidth - scaledWidth;
|
offsetX = backgroundWidth - scaledWidth;
|
||||||
offsetY = backgroundHeight - scaledHeight;
|
offsetY = backgroundHeight - scaledHeight;
|
||||||
@@ -155,4 +159,3 @@ public class ContentBadge :
|
|||||||
UpdateBadge();
|
UpdateBadge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,4 +7,3 @@ public enum ContentBadgePlacement
|
|||||||
BottomLeft,
|
BottomLeft,
|
||||||
BottomRight
|
BottomRight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,15 +75,14 @@
|
|||||||
BadgePath="{TemplateBinding BadgePath}"
|
BadgePath="{TemplateBinding BadgePath}"
|
||||||
BadgePlacement="{TemplateBinding BadgePlacement}"
|
BadgePlacement="{TemplateBinding BadgePlacement}"
|
||||||
BadgeSize="{TemplateBinding BadgeSize}"
|
BadgeSize="{TemplateBinding BadgeSize}"
|
||||||
Foreground="Red"
|
Foreground="{TemplateBinding BadgeBrush}"
|
||||||
IsBadgeVisible="{TemplateBinding IsBadgeVisible}">
|
IsBadgeVisible="{TemplateBinding IsBadgeVisible}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_ContentPresenter"
|
Name="PART_ContentPresenter"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}" />
|
||||||
/>
|
|
||||||
<Border
|
<Border
|
||||||
Name="SelectionIndicator"
|
Name="SelectionIndicator"
|
||||||
BorderBrush="{DynamicResource AccentFillColorDefaultBrush}"
|
BorderBrush="{DynamicResource AccentFillColorDefaultBrush}"
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class Overflow :
|
|||||||
private static readonly StyledProperty<OverflowTemplateSettings> TemplateSettingsProperty =
|
private static readonly StyledProperty<OverflowTemplateSettings> TemplateSettingsProperty =
|
||||||
AvaloniaProperty.Register<Overflow, OverflowTemplateSettings>(nameof(TemplateSettings));
|
AvaloniaProperty.Register<Overflow, OverflowTemplateSettings>(nameof(TemplateSettings));
|
||||||
|
|
||||||
|
|
||||||
private readonly ObservableCollection<object> primaryCollection = [];
|
private readonly ObservableCollection<object> primaryCollection = [];
|
||||||
|
|
||||||
private readonly ObservableCollection<object> secondaryCollection = [];
|
private readonly ObservableCollection<object> secondaryCollection = [];
|
||||||
@@ -60,6 +59,7 @@ public class Overflow :
|
|||||||
get => GetValue(ItemsSourceProperty);
|
get => GetValue(ItemsSourceProperty);
|
||||||
set => SetValue(ItemsSourceProperty, value);
|
set => SetValue(ItemsSourceProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[InheritDataTypeFromItems(nameof(ItemsSource))]
|
[InheritDataTypeFromItems(nameof(ItemsSource))]
|
||||||
public IDataTemplate? ItemTemplate
|
public IDataTemplate? ItemTemplate
|
||||||
{
|
{
|
||||||
@@ -146,6 +146,7 @@ public class Overflow :
|
|||||||
object? selection = args.GetNewValue<object>();
|
object? selection = args.GetNewValue<object>();
|
||||||
SetValue(SelectedItemProperty, selection);
|
SetValue(SelectedItemProperty, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSourceCollectionChanged(object? sender,
|
private void OnSourceCollectionChanged(object? sender,
|
||||||
NotifyCollectionChangedEventArgs args)
|
NotifyCollectionChangedEventArgs args)
|
||||||
{
|
{
|
||||||
@@ -307,4 +308,3 @@ public class Overflow :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
public class OverflowItem :
|
public class OverflowItem :
|
||||||
ListBoxItem
|
ListBoxItem
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<double> BadgeSizeProperty =
|
public static readonly StyledProperty<IBrush> BadgeBrushProperty =
|
||||||
AvaloniaProperty.Register<OverflowItem, double>(nameof(BadgeSize), 14);
|
AvaloniaProperty.Register<OverflowItem, IBrush>(nameof(BadgeBrush));
|
||||||
|
|
||||||
public static readonly StyledProperty<bool> IsBadgeVisibleProperty =
|
|
||||||
AvaloniaProperty.Register<OverflowItem, bool>(nameof(IsBadgeVisible), true);
|
|
||||||
|
|
||||||
public static readonly StyledProperty<string> BadgePathProperty =
|
public static readonly StyledProperty<string> BadgePathProperty =
|
||||||
AvaloniaProperty.Register<OverflowItem, string>(nameof(BadgePath));
|
AvaloniaProperty.Register<OverflowItem, string>(nameof(BadgePath));
|
||||||
@@ -18,6 +16,18 @@ public class OverflowItem :
|
|||||||
public static readonly StyledProperty<ContentBadgePlacement> BadgePlacementProperty =
|
public static readonly StyledProperty<ContentBadgePlacement> BadgePlacementProperty =
|
||||||
AvaloniaProperty.Register<OverflowItem, ContentBadgePlacement>(nameof(BadgePlacement), ContentBadgePlacement.BottomRight);
|
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
|
public string BadgePath
|
||||||
{
|
{
|
||||||
get => GetValue(BadgePathProperty);
|
get => GetValue(BadgePathProperty);
|
||||||
@@ -42,4 +52,3 @@ public class OverflowItem :
|
|||||||
set => SetValue(IsBadgeVisibleProperty, value);
|
set => SetValue(IsBadgeVisibleProperty, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,4 +46,3 @@ public class OverflowTemplateSettings :
|
|||||||
set => SetValue(SecondarySelectionProperty, value);
|
set => SetValue(SecondarySelectionProperty, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,4 +40,3 @@ public class TemplateListBox :
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Avalonia.Media.Imaging;
|
|||||||
|
|
||||||
namespace Toolkit.UI.Controls.Avalonia;
|
namespace Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
|
|
||||||
public class PersonPicture : TemplatedControl
|
public class PersonPicture : TemplatedControl
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<string> BadgeGlyphProperty =
|
public static readonly StyledProperty<string> BadgeGlyphProperty =
|
||||||
|
|||||||
@@ -8,15 +8,56 @@ public class PersonPictureColourGenerator
|
|||||||
{
|
{
|
||||||
private readonly string[] colours =
|
private readonly string[] colours =
|
||||||
[
|
[
|
||||||
"#FFB900", "#FF8C00", "#F7630C", "#CA5010", "#DA3B01", "#EF6950", "#D13438", "#FF4343",
|
"#FFB900",
|
||||||
"#E74856", "#E81123", "#EA005E", "#C30052", "#E3008C", "#BF0077", "#C239B3", "#9A0089",
|
"#FF8C00",
|
||||||
"#0078D7", "#0063B1", "#8E8CD8", "#6B69D6", "#8764B8", "#744DA9", "#B146C2", "#881798",
|
"#F7630C",
|
||||||
"#0099BC", "#2D7D9A", "#00B7C3", "#038387", "#00B294", "#018574", "#00CC6A", "#10893E",
|
"#CA5010",
|
||||||
"#7A7574", "#5D5A58", "#68768A", "#515C6B", "#567C73", "#486860", "#498205", "#107C10",
|
"#DA3B01",
|
||||||
"#767676", "#4C4A48", "#69797E", "#4A5459", "#647C64", "#525E54", "#847545", "#7E735F"
|
"#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)
|
public Color GenerateColour(string input)
|
||||||
{
|
{
|
||||||
byte[] hashBytes = GetHash(input);
|
byte[] hashBytes = GetHash(input);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ public class SettingsExpander :
|
|||||||
set => SetValue(IsToggleableProperty, value);
|
set => SetValue(IsToggleableProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override Type StyleKeyOverride =>
|
protected override Type StyleKeyOverride =>
|
||||||
typeof(SettingsExpander);
|
typeof(SettingsExpander);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user