feat: remove EnumSelector in demo.
This commit is contained in:
@@ -27,6 +27,25 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
[ObservableProperty] private bool _fullScreen;
|
||||
[ObservableProperty] private bool _showInTaskBar;
|
||||
|
||||
public ObservableCollection<DialogButton> DialogButtons =>
|
||||
[
|
||||
DialogButton.None,
|
||||
DialogButton.OK,
|
||||
DialogButton.OKCancel,
|
||||
DialogButton.YesNo,
|
||||
DialogButton.YesNoCancel,
|
||||
];
|
||||
|
||||
public ObservableCollection<DialogMode> DialogModes =>
|
||||
[
|
||||
DialogMode.Info,
|
||||
DialogMode.Warning,
|
||||
DialogMode.Error,
|
||||
DialogMode.Question,
|
||||
DialogMode.None,
|
||||
DialogMode.Success,
|
||||
];
|
||||
|
||||
public DialogDemoViewModel()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Controls;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Common;
|
||||
@@ -12,7 +11,7 @@ using Ursa.Demo.Dialogs;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class DrawerDemoViewModel: ObservableObject
|
||||
public partial class DrawerDemoViewModel : ObservableObject
|
||||
{
|
||||
public ICommand ShowDialogCommand { get; set; }
|
||||
public ICommand ShowCustomDialogCommand { get; set; }
|
||||
@@ -25,8 +24,24 @@ public partial class DrawerDemoViewModel: ObservableObject
|
||||
[ObservableProperty] private bool _result;
|
||||
[ObservableProperty] private bool _isModal;
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
|
||||
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
|
||||
public ObservableCollection<DialogButton> DialogButtons =>
|
||||
[
|
||||
DialogButton.None,
|
||||
DialogButton.OK,
|
||||
DialogButton.OKCancel,
|
||||
DialogButton.YesNo,
|
||||
DialogButton.YesNoCancel,
|
||||
];
|
||||
|
||||
public DrawerDemoViewModel()
|
||||
{
|
||||
ShowDialogCommand = new AsyncRelayCommand(ShowDefaultDialog);
|
||||
@@ -35,7 +50,7 @@ public partial class DrawerDemoViewModel: ObservableObject
|
||||
IsGlobal = true;
|
||||
IsModal = true;
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowDefaultDialog()
|
||||
{
|
||||
var vm = new PlainDialogViewModel();
|
||||
@@ -67,7 +82,7 @@ public partial class DrawerDemoViewModel: ObservableObject
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowCustomDrawer()
|
||||
{
|
||||
var vm = new DialogWithActionViewModel();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia.Controls.Primitives;
|
||||
using System.Collections.ObjectModel;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
@@ -23,6 +24,35 @@ public partial class ElasticWrapPanelDemoViewModel : ObservableObject
|
||||
[ObservableProperty] private HorizontalAlignment _cmbHAlign = HorizontalAlignment.Left;
|
||||
[ObservableProperty] private VerticalAlignment _cmbVAlign = VerticalAlignment.Stretch;
|
||||
|
||||
public ObservableCollection<Orientation> Orientations =>
|
||||
[
|
||||
Orientation.Horizontal,
|
||||
Orientation.Vertical,
|
||||
];
|
||||
|
||||
public ObservableCollection<ScrollBarVisibility> ScrollBarVisibilities =>
|
||||
[
|
||||
ScrollBarVisibility.Auto,
|
||||
ScrollBarVisibility.Hidden,
|
||||
ScrollBarVisibility.Visible,
|
||||
];
|
||||
|
||||
public ObservableCollection<HorizontalAlignment> HorizontalAlignments =>
|
||||
[
|
||||
HorizontalAlignment.Left,
|
||||
HorizontalAlignment.Center,
|
||||
HorizontalAlignment.Right,
|
||||
HorizontalAlignment.Stretch,
|
||||
];
|
||||
|
||||
public ObservableCollection<VerticalAlignment> VerticalAlignments =>
|
||||
[
|
||||
VerticalAlignment.Top,
|
||||
VerticalAlignment.Center,
|
||||
VerticalAlignment.Bottom,
|
||||
VerticalAlignment.Stretch,
|
||||
];
|
||||
|
||||
private double _oldItemSelfWidth;
|
||||
private double _oldItemSelfHeight;
|
||||
|
||||
|
||||
@@ -1,12 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class FormDemoViewModel: ObservableObject
|
||||
public partial class FormDemoViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private DataModel _model;
|
||||
[ObservableProperty] private Position _selectedPosition = Position.Top;
|
||||
[ObservableProperty] private HorizontalAlignment _selectedHorizontalAlignment = HorizontalAlignment.Left;
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
|
||||
public ObservableCollection<HorizontalAlignment> HorizontalAlignments =>
|
||||
[
|
||||
HorizontalAlignment.Stretch,
|
||||
HorizontalAlignment.Left,
|
||||
HorizontalAlignment.Center,
|
||||
HorizontalAlignment.Right,
|
||||
];
|
||||
|
||||
public FormDemoViewModel()
|
||||
{
|
||||
@@ -21,28 +42,30 @@ public partial class DataModel : ObservableObject
|
||||
[MinLength(10)]
|
||||
public string Name
|
||||
{
|
||||
get=>_name;
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
|
||||
private double _number;
|
||||
|
||||
[Range(0.0, 10.0)]
|
||||
public double Number
|
||||
{
|
||||
get => _number;
|
||||
set => SetProperty(ref _number, value);
|
||||
}
|
||||
|
||||
|
||||
private string _email;
|
||||
|
||||
|
||||
[EmailAddress]
|
||||
public string Email
|
||||
{
|
||||
get=>_email;
|
||||
get => _email;
|
||||
set => SetProperty(ref _email, value);
|
||||
}
|
||||
|
||||
private DateTime _date;
|
||||
|
||||
public DateTime Date
|
||||
{
|
||||
get => _date;
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class IconButtonDemoViewModel: ObservableObject
|
||||
public partial class IconButtonDemoViewModel : ObservableObject
|
||||
{
|
||||
|
||||
[ObservableProperty] private Position _selectedPosition = Position.Top;
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
}
|
||||
@@ -1,19 +1,29 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class ToolBarDemoViewModel: ObservableObject
|
||||
public partial class ToolBarDemoViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private Orientation _selectedOrientation;
|
||||
|
||||
public ObservableCollection<Orientation> Orientations =>
|
||||
[
|
||||
Orientation.Horizontal,
|
||||
Orientation.Vertical
|
||||
];
|
||||
|
||||
public ObservableCollection<ToolBarItemViewModel> Items { get; set; }
|
||||
|
||||
public ToolBarDemoViewModel()
|
||||
{
|
||||
Items = new()
|
||||
{
|
||||
new ToolBarButtonItemViewModel() { Content = "New", OverflowMode = OverflowMode.AsNeeded},
|
||||
new ToolBarButtonItemViewModel() { Content = "New", OverflowMode = OverflowMode.AsNeeded },
|
||||
new ToolBarButtonItemViewModel() { Content = "Open" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save1" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save2" },
|
||||
@@ -26,18 +36,18 @@ public partial class ToolBarDemoViewModel: ObservableObject
|
||||
new ToolBarSeparatorViewModel(),
|
||||
new ToolBarButtonItemViewModel() { Content = "Save8" },
|
||||
new ToolBarCheckBoxItemViweModel() { Content = "Bold" },
|
||||
new ToolBarCheckBoxItemViweModel() { Content = "Italic", OverflowMode = OverflowMode.Never},
|
||||
new ToolBarComboBoxItemViewModel() { Content = "Font Size", Items = new (){ "10", "12", "14" } }
|
||||
new ToolBarCheckBoxItemViweModel() { Content = "Italic", OverflowMode = OverflowMode.Never },
|
||||
new ToolBarComboBoxItemViewModel() { Content = "Font Size", Items = new() { "10", "12", "14" } }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ToolBarItemViewModel: ObservableObject
|
||||
public abstract class ToolBarItemViewModel : ObservableObject
|
||||
{
|
||||
public OverflowMode OverflowMode { get; set; }
|
||||
}
|
||||
|
||||
public class ToolBarButtonItemViewModel: ToolBarItemViewModel
|
||||
public class ToolBarButtonItemViewModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public ICommand Command { get; set; }
|
||||
@@ -48,7 +58,7 @@ public class ToolBarButtonItemViewModel: ToolBarItemViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolBarCheckBoxItemViweModel: ToolBarItemViewModel
|
||||
public class ToolBarCheckBoxItemViweModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public bool IsChecked { get; set; }
|
||||
@@ -60,12 +70,13 @@ public class ToolBarCheckBoxItemViweModel: ToolBarItemViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolBarComboBoxItemViewModel: ToolBarItemViewModel
|
||||
public class ToolBarComboBoxItemViewModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public ObservableCollection<string> Items { get; set; }
|
||||
|
||||
private string _selectedItem;
|
||||
|
||||
public string SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
@@ -77,7 +88,6 @@ public class ToolBarComboBoxItemViewModel: ToolBarItemViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolBarSeparatorViewModel: ToolBarItemViewModel
|
||||
public class ToolBarSeparatorViewModel : ToolBarItemViewModel
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user