Files
TheXamlGuy 93c7a43ab4 Codemaid
2024-07-17 21:43:58 +01:00

48 lines
1.3 KiB
C#

using Avalonia;
namespace Toolkit.UI.Controls.Avalonia;
public class OverflowTemplateSettings :
AvaloniaObject
{
public static readonly StyledProperty<object?> PrimarySelectionProperty =
AvaloniaProperty.Register<OverflowTemplateSettings, object?>(nameof(PrimarySelection));
public static readonly StyledProperty<object?> SecondarySelectionProperty =
AvaloniaProperty.Register<OverflowTemplateSettings, object?>(nameof(SecondarySelection));
private bool isSelectionChanging;
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs args)
{
base.OnPropertyChanged(args);
if (!isSelectionChanging)
{
isSelectionChanging = true;
if (args.Property == PrimarySelectionProperty)
{
SecondarySelection = null;
}
else if (args.Property == SecondarySelectionProperty)
{
PrimarySelection = null;
}
isSelectionChanging = false;
}
}
public object? PrimarySelection
{
get => GetValue(PrimarySelectionProperty);
set => SetValue(PrimarySelectionProperty, value);
}
public object? SecondarySelection
{
get => GetValue(SecondarySelectionProperty);
set => SetValue(SecondarySelectionProperty, value);
}
}