misc: rename & remove.
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
<u:Rating
|
<u:Rating
|
||||||
AllowClear="{Binding AllowClear}"
|
AllowClear="{Binding AllowClear}"
|
||||||
AllowHalf="{Binding AllowHalf}"
|
AllowHalf="{Binding AllowHalf}"
|
||||||
AllowFocus="{Binding AllowFocus}"
|
|
||||||
IsEnabled="{Binding IsEnabled}"
|
IsEnabled="{Binding IsEnabled}"
|
||||||
Value="{Binding Value}"
|
Value="{Binding Value}"
|
||||||
Count="{Binding Count}"
|
Count="{Binding Count}"
|
||||||
@@ -31,7 +30,6 @@
|
|||||||
Classes="Small"
|
Classes="Small"
|
||||||
AllowClear="{Binding AllowClear}"
|
AllowClear="{Binding AllowClear}"
|
||||||
AllowHalf="{Binding AllowHalf}"
|
AllowHalf="{Binding AllowHalf}"
|
||||||
AllowFocus="{Binding AllowFocus}"
|
|
||||||
IsEnabled="{Binding IsEnabled}"
|
IsEnabled="{Binding IsEnabled}"
|
||||||
Value="{Binding Value}"
|
Value="{Binding Value}"
|
||||||
Count="{Binding Count}"
|
Count="{Binding Count}"
|
||||||
@@ -40,7 +38,6 @@
|
|||||||
Size="48"
|
Size="48"
|
||||||
AllowClear="{Binding AllowClear}"
|
AllowClear="{Binding AllowClear}"
|
||||||
AllowHalf="{Binding AllowHalf}"
|
AllowHalf="{Binding AllowHalf}"
|
||||||
AllowFocus="{Binding AllowFocus}"
|
|
||||||
IsEnabled="{Binding IsEnabled}"
|
IsEnabled="{Binding IsEnabled}"
|
||||||
Value="{Binding Value}"
|
Value="{Binding Value}"
|
||||||
Count="{Binding Count}"
|
Count="{Binding Count}"
|
||||||
@@ -71,16 +68,6 @@
|
|||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsChecked="{Binding AllowHalf}" />
|
IsChecked="{Binding AllowHalf}" />
|
||||||
<Label
|
|
||||||
Grid.Row="2"
|
|
||||||
Grid.Column="0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Content="AllowFocus" />
|
|
||||||
<ToggleSwitch
|
|
||||||
Grid.Row="2"
|
|
||||||
Grid.Column="1"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
IsChecked="{Binding AllowFocus}" />
|
|
||||||
<Label
|
<Label
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class MenuViewModel: ViewModelBase
|
|||||||
new() { MenuHeader = "NumPad", Key = MenuKeys.MenuKeyNumPad },
|
new() { MenuHeader = "NumPad", Key = MenuKeys.MenuKeyNumPad },
|
||||||
new() { MenuHeader = "Pagination", Key = MenuKeys.MenuKeyPagination },
|
new() { MenuHeader = "Pagination", Key = MenuKeys.MenuKeyPagination },
|
||||||
new() { MenuHeader = "RangeSlider", Key = MenuKeys.MenuKeyRangeSlider },
|
new() { MenuHeader = "RangeSlider", Key = MenuKeys.MenuKeyRangeSlider },
|
||||||
new() { MenuHeader = "Rating", Key = MenuKeys.MenuKeyRating },
|
new() { MenuHeader = "Rating", Key = MenuKeys.MenuKeyRating, Status = "New"},
|
||||||
new() { MenuHeader = "Scroll To", Key = MenuKeys.MenuKeyScrollToButton },
|
new() { MenuHeader = "Scroll To", Key = MenuKeys.MenuKeyScrollToButton },
|
||||||
new() { MenuHeader = "Selection List", Key = MenuKeys.MenuKeySelectionList },
|
new() { MenuHeader = "Selection List", Key = MenuKeys.MenuKeySelectionList },
|
||||||
new() { MenuHeader = "Skeleton", Key = MenuKeys.MenuKeySkeleton },
|
new() { MenuHeader = "Skeleton", Key = MenuKeys.MenuKeySkeleton },
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.ObjectModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
|
|
||||||
namespace Ursa.Demo.ViewModels;
|
namespace Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
@@ -7,14 +6,8 @@ public partial class RatingDemoViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
[ObservableProperty] private bool _allowClear = true;
|
[ObservableProperty] private bool _allowClear = true;
|
||||||
[ObservableProperty] private bool _allowHalf = true;
|
[ObservableProperty] private bool _allowHalf = true;
|
||||||
[ObservableProperty] private bool _allowFocus;
|
|
||||||
[ObservableProperty] private bool _isEnabled = true;
|
[ObservableProperty] private bool _isEnabled = true;
|
||||||
|
|
||||||
[ObservableProperty] private double _value;
|
[ObservableProperty] private double _value;
|
||||||
|
|
||||||
[ObservableProperty] private double _defaultValue = 2.3;
|
[ObservableProperty] private double _defaultValue = 2.3;
|
||||||
[ObservableProperty] private int _count = 5;
|
[ObservableProperty] private int _count = 5;
|
||||||
// [ObservableProperty] private object _character;
|
|
||||||
|
|
||||||
public ObservableCollection<string> Tooltips { get; set; } = ["1", "2", "3", "4", "5"];
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
Data="{TemplateBinding Character}"
|
Data="{TemplateBinding Character}"
|
||||||
Fill="{TemplateBinding Background}" />
|
Fill="{TemplateBinding Background}" />
|
||||||
<Border Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
|
<Border Name="{x:Static u:RatingCharacter.PART_IconBorder}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
ClipToBounds="True">
|
ClipToBounds="True">
|
||||||
<Path Width="{Binding #PART_Root.Width}"
|
<Path Width="{Binding #PART_Root.Width}"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<Style Selector="^:pointerover">
|
<Style Selector="^:pointerover">
|
||||||
<Setter Property="RenderTransform" Value="scale(1.1)" />
|
<Setter Property="RenderTransform" Value="scale(1.1)" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:selected /template/ Border#PART_IconGlyph">
|
<Style Selector="^:selected /template/ Border#PART_IconBorder">
|
||||||
<Setter Property="IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ public class Rating : TemplatedControl
|
|||||||
public const string PART_ItemsControl = "PART_ItemsControl";
|
public const string PART_ItemsControl = "PART_ItemsControl";
|
||||||
protected const string PC_Selected = ":selected";
|
protected const string PC_Selected = ":selected";
|
||||||
|
|
||||||
private ItemsControl? _itemsControl;
|
|
||||||
|
|
||||||
public static readonly StyledProperty<double> ValueProperty =
|
public static readonly StyledProperty<double> ValueProperty =
|
||||||
AvaloniaProperty.Register<Rating, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
AvaloniaProperty.Register<Rating, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
|
||||||
|
|
||||||
@@ -26,9 +24,6 @@ public class Rating : TemplatedControl
|
|||||||
public static readonly StyledProperty<bool> AllowHalfProperty =
|
public static readonly StyledProperty<bool> AllowHalfProperty =
|
||||||
AvaloniaProperty.Register<Rating, bool>(nameof(AllowHalf));
|
AvaloniaProperty.Register<Rating, bool>(nameof(AllowHalf));
|
||||||
|
|
||||||
public static readonly StyledProperty<bool> AllowFocusProperty =
|
|
||||||
AvaloniaProperty.Register<Rating, bool>(nameof(AllowFocus));
|
|
||||||
|
|
||||||
public static readonly StyledProperty<object> CharacterProperty =
|
public static readonly StyledProperty<object> CharacterProperty =
|
||||||
AvaloniaProperty.Register<Rating, object>(nameof(Character));
|
AvaloniaProperty.Register<Rating, object>(nameof(Character));
|
||||||
|
|
||||||
@@ -62,12 +57,6 @@ public class Rating : TemplatedControl
|
|||||||
set => SetValue(AllowHalfProperty, value);
|
set => SetValue(AllowHalfProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AllowFocus
|
|
||||||
{
|
|
||||||
get => GetValue(AllowFocusProperty);
|
|
||||||
set => SetValue(AllowFocusProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Character
|
public object Character
|
||||||
{
|
{
|
||||||
get => GetValue(CharacterProperty);
|
get => GetValue(CharacterProperty);
|
||||||
@@ -177,8 +166,6 @@ public class Rating : TemplatedControl
|
|||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
|
|
||||||
_itemsControl = e.NameScope.Find<ItemsControl>(PART_ItemsControl);
|
|
||||||
for (var i = 0; i < Count; i++)
|
for (var i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
Items.Add(new RatingCharacter
|
Items.Add(new RatingCharacter
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ using Avalonia.LogicalTree;
|
|||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
|
|
||||||
[PseudoClasses(PC_Selected)]
|
[PseudoClasses(PC_Selected)]
|
||||||
[TemplatePart(PART_IconGlyph, typeof(Control))]
|
[TemplatePart(PART_IconBorder, typeof(Border))]
|
||||||
public class RatingCharacter : TemplatedControl
|
public class RatingCharacter : TemplatedControl
|
||||||
{
|
{
|
||||||
public const string PART_IconGlyph = "PART_IconGlyph";
|
public const string PART_IconBorder = "PART_IconBorder";
|
||||||
protected const string PC_Selected = ":selected";
|
protected const string PC_Selected = ":selected";
|
||||||
|
|
||||||
private Control? _icon;
|
private Border? _icon;
|
||||||
|
|
||||||
public static readonly StyledProperty<bool> AllowHalfProperty =
|
public static readonly StyledProperty<bool> AllowHalfProperty =
|
||||||
Rating.AllowHalfProperty.AddOwner<RatingCharacter>();
|
Rating.AllowHalfProperty.AddOwner<RatingCharacter>();
|
||||||
@@ -71,7 +71,7 @@ public class RatingCharacter : TemplatedControl
|
|||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
_icon = e.NameScope.Find<Control>(PART_IconGlyph);
|
_icon = e.NameScope.Find<Border>(PART_IconBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPointerEntered(PointerEventArgs e)
|
protected override void OnPointerEntered(PointerEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user