48
demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs
Normal file
48
demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class FormDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private DataModel _model;
|
||||
|
||||
public FormDemoViewModel()
|
||||
{
|
||||
Model = new DataModel();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class DataModel : ObservableObject
|
||||
{
|
||||
private string _name;
|
||||
|
||||
[MinLength(10)]
|
||||
public string Name
|
||||
{
|
||||
get=>_name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
|
||||
private string _email;
|
||||
|
||||
[EmailAddress]
|
||||
public string Email
|
||||
{
|
||||
get=>_email;
|
||||
set => SetProperty(ref _email, value);
|
||||
}
|
||||
|
||||
private DateTime _date;
|
||||
public DateTime Date
|
||||
{
|
||||
get => _date;
|
||||
set => SetProperty(ref _date, value);
|
||||
}
|
||||
|
||||
public DataModel()
|
||||
{
|
||||
Date = DateTime.Today;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyDrawer => new DrawerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDualBadge => new DualBadgeDemoViewModel(),
|
||||
MenuKeys.MenuKeyEnumSelector => new EnumSelectorDemoViewModel(),
|
||||
MenuKeys.MenuKeyForm => new FormDemoViewModel(),
|
||||
MenuKeys.MenuKeyImageViewer => new ImageViewerDemoViewModel(),
|
||||
MenuKeys.MenuKeyIconButton => new IconButtonDemoViewModel(),
|
||||
MenuKeys.MenuKeyIpBox => new IPv4BoxDemoViewModel(),
|
||||
|
||||
@@ -22,6 +22,7 @@ public class MenuViewModel: ViewModelBase
|
||||
new() { MenuHeader = "Drawer", Key = MenuKeys.MenuKeyDrawer },
|
||||
new() { MenuHeader = "DualBadge", Key = MenuKeys.MenuKeyDualBadge },
|
||||
new() { MenuHeader = "Enum Selector", Key = MenuKeys.MenuKeyEnumSelector },
|
||||
new() { MenuHeader = "Form", Key = MenuKeys.MenuKeyForm },
|
||||
new() { MenuHeader = "Icon Button", Key = MenuKeys.MenuKeyIconButton },
|
||||
new() { MenuHeader = "ImageViewer", Key = MenuKeys.MenuKeyImageViewer },
|
||||
new() { MenuHeader = "IPv4Box", Key = MenuKeys.MenuKeyIpBox },
|
||||
|
||||
Reference in New Issue
Block a user