feat: add transition based number displayer.
This commit is contained in:
@@ -20,6 +20,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyMessageBox = "MessageBox";
|
||||
public const string MenuKeyNavigation = "Navigation";
|
||||
public const string MenuKeyNavMenu = "NavMenu";
|
||||
public const string MenuKeyNumberDisplayer = "NumberDisplayer";
|
||||
public const string MenuKeyNumericUpDown = "NumericUpDown";
|
||||
public const string MenuKeyPagination = "Pagination";
|
||||
public const string MenuKeyRangeSlider = "RangeSlider";
|
||||
|
||||
16
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml
Normal file
16
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml
Normal file
@@ -0,0 +1,16 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
x:DataType="vm:NumberDisplayerDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.NumberDisplayerDemo">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<Button Command="{Binding IncreaseCommand}" >Change</Button>
|
||||
<u:Int32Displayer Value="{Binding Value}"></u:Int32Displayer>
|
||||
<u:DoubleDisplayer Value="{Binding DoubleValue}" StringFormat="N2"></u:DoubleDisplayer>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class NumberDisplayerDemo : UserControl
|
||||
{
|
||||
public NumberDisplayerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyMessageBox => new MessageBoxDemoViewModel(),
|
||||
MenuKeys.MenuKeyNavigation => new NavigationMenuDemoViewModel(),
|
||||
MenuKeys.MenuKeyNavMenu => new NavMenuDemoViewModel(),
|
||||
MenuKeys.MenuKeyNumberDisplayer => new NumberDisplayerDemoViewModel(),
|
||||
MenuKeys.MenuKeyNumericUpDown => new NumericUpDownDemoViewModel(),
|
||||
MenuKeys.MenuKeyPagination => new PaginationDemoViewModel(),
|
||||
MenuKeys.MenuKeyRangeSlider => new RangeSliderDemoViewModel(),
|
||||
|
||||
@@ -29,7 +29,8 @@ public class MenuViewModel: ViewModelBase
|
||||
new() { MenuHeader = "Message Box", Key = MenuKeys.MenuKeyMessageBox, Status = "New" },
|
||||
new() { MenuHeader = "Navigation", Key = MenuKeys.MenuKeyNavigation, Status = "WIP" },
|
||||
new() { MenuHeader = "Nav Menu", Key = MenuKeys.MenuKeyNavMenu, Status = "WIP"},
|
||||
new() { MenuHeader = "NumericUpDown", Key = MenuKeys.MenuKeyNumericUpDown, Status = "New" },
|
||||
new() { MenuHeader = "Number Displayer", Key = MenuKeys.MenuKeyNumberDisplayer, Status = "New" },
|
||||
new() { MenuHeader = "Numeric UpDown", Key = MenuKeys.MenuKeyNumericUpDown, Status = "New" },
|
||||
new() { MenuHeader = "Pagination", Key = MenuKeys.MenuKeyPagination },
|
||||
new() { MenuHeader = "RangeSlider", Key = MenuKeys.MenuKeyRangeSlider, Status = "New"},
|
||||
new() { MenuHeader = "Selection List", Key = MenuKeys.MenuKeySelectionList, Status = "New" },
|
||||
|
||||
26
demo/Ursa.Demo/ViewModels/NumberDisplayerDemoViewModel.cs
Normal file
26
demo/Ursa.Demo/ViewModels/NumberDisplayerDemoViewModel.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class NumberDisplayerDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private int _value;
|
||||
[ObservableProperty] private double _doubleValue;
|
||||
public ICommand IncreaseCommand { get; }
|
||||
public NumberDisplayerDemoViewModel()
|
||||
{
|
||||
IncreaseCommand = new RelayCommand(OnChange);
|
||||
Value = 0;
|
||||
DoubleValue = 0d;
|
||||
}
|
||||
|
||||
private void OnChange()
|
||||
{
|
||||
Random r = new Random();
|
||||
Value = r.Next(int.MaxValue);
|
||||
DoubleValue = r.NextDouble() * 100000;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user