diff --git a/Ursa.sln.DotSettings b/Ursa.sln.DotSettings
new file mode 100644
index 0000000..a8569d1
--- /dev/null
+++ b/Ursa.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/demo/Sandbox/App.axaml.cs b/demo/Sandbox/App.axaml.cs
index c6033ba..3ead0df 100644
--- a/demo/Sandbox/App.axaml.cs
+++ b/demo/Sandbox/App.axaml.cs
@@ -1,6 +1,5 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Sandbox.ViewModels;
diff --git a/demo/Ursa.Demo.iOS/AppDelegate.cs b/demo/Ursa.Demo.iOS/AppDelegate.cs
index a565165..2954d1a 100644
--- a/demo/Ursa.Demo.iOS/AppDelegate.cs
+++ b/demo/Ursa.Demo.iOS/AppDelegate.cs
@@ -1,9 +1,6 @@
using Foundation;
-using UIKit;
using Avalonia;
-using Avalonia.Controls;
using Avalonia.iOS;
-using Avalonia.Media;
namespace Ursa.Demo.iOS;
diff --git a/demo/Ursa.Demo/Converters/IconNameConverter.cs b/demo/Ursa.Demo/Converters/IconNameConverter.cs
index 4d1fe99..98c82c6 100644
--- a/demo/Ursa.Demo/Converters/IconNameConverter.cs
+++ b/demo/Ursa.Demo/Converters/IconNameConverter.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
-using System.Linq;
using Avalonia;
-using Avalonia.Controls.Shapes;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Avalonia.Metadata;
@@ -25,7 +23,7 @@ public class IconNameConverter: IValueConverter
return AvaloniaProperty.UnsetValue;
}
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
diff --git a/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs b/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs
index 4451895..d9e2a08 100644
--- a/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs
+++ b/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using Avalonia;
-using Avalonia.Controls;
using Avalonia.Data.Converters;
using Avalonia.Media;
@@ -9,7 +8,7 @@ namespace Ursa.Demo.Converters;
public class IconNameToPathConverter: IValueConverter
{
- private string[] paths = new[]
+ private readonly string[] _paths = new[]
{
"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",
"M16 12L9 2L2 12H3.86L0 18H7V22H11V18H18L14.14 12H16M20.14 12H22L15 2L12.61 5.41L17.92 13H15.97L19.19 18H24L20.14 12M13 19H17V22H13V19Z",
@@ -19,23 +18,23 @@ public class IconNameToPathConverter: IValueConverter
"M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",
"M12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22C17.5 22 22 17.5 22 12S17.5 2 12 2M12.5 13H11V7H12.5V11.3L16.2 9.2L17 10.5L12.5 13Z"
};
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is int i)
{
- string s = paths[i % paths.Length];
+ var s = _paths[i % _paths.Length];
return StreamGeometry.Parse(s);
}
else if (value is string s)
{
- int hash = s.GetHashCode();
- string path = paths[Math.Abs(hash) % paths.Length];
+ var hash = s.GetHashCode();
+ var path = _paths[Math.Abs(hash) % _paths.Length];
return StreamGeometry.Parse(path);
}
- return AvaloniaProperty.UnsetValue;
+ return AvaloniaProperty.UnsetValue;
}
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return AvaloniaProperty.UnsetValue;
}
diff --git a/demo/Ursa.Demo/Converters/TimelineIconConverter.cs b/demo/Ursa.Demo/Converters/TimelineIconConverter.cs
index 04d46f4..8197a63 100644
--- a/demo/Ursa.Demo/Converters/TimelineIconConverter.cs
+++ b/demo/Ursa.Demo/Converters/TimelineIconConverter.cs
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using Avalonia;
-using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Ursa.Controls;
@@ -10,7 +9,7 @@ namespace Ursa.Demo.Converters;
public class TimelineIconConverter: IValueConverter
{
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is TimelineItemType t)
{
@@ -25,7 +24,7 @@ public class TimelineIconConverter: IValueConverter
return AvaloniaProperty.UnsetValue;
}
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
diff --git a/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs b/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs
index bfd9c76..fcbe6a4 100644
--- a/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs
+++ b/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs
@@ -14,11 +14,11 @@ public class ToolBarItemTemplateSelector: IDataTemplate
public Control? Build(object? param)
{
if (param is null) return null;
- if (param is ToolBarSeparatorViewModel sep)
+ if (param is ToolBarSeparatorViewModel)
{
return new ToolBarSeparator();
}
- if (param is ToolBarButtonItemViewModel vm)
+ if (param is ToolBarButtonItemViewModel)
{
return new Button()
{
@@ -27,7 +27,7 @@ public class ToolBarItemTemplateSelector: IDataTemplate
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
};
}
- if (param is ToolBarCheckBoxItemViweModel cb)
+ if (param is ToolBarCheckBoxItemViweModel)
{
return new CheckBox()
{
@@ -36,7 +36,7 @@ public class ToolBarItemTemplateSelector: IDataTemplate
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
};
}
- if (param is ToolBarComboBoxItemViewModel combo)
+ if (param is ToolBarComboBoxItemViewModel)
{
return new ComboBox()
{
diff --git a/demo/Ursa.Demo/DataTemplates/ViewLocator.cs b/demo/Ursa.Demo/DataTemplates/ViewLocator.cs
index fbbbece..15e3d99 100644
--- a/demo/Ursa.Demo/DataTemplates/ViewLocator.cs
+++ b/demo/Ursa.Demo/DataTemplates/ViewLocator.cs
@@ -1,7 +1,6 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
-using Ursa.Demo.Pages;
namespace Ursa.Demo.Converters;
@@ -10,16 +9,13 @@ public class ViewLocator: IDataTemplate
public Control? Build(object? param)
{
if (param is null) return null;
- var name = param.GetType().Name!.Replace("ViewModel", "");
+ var name = param.GetType().Name.Replace("ViewModel", "");
var type = Type.GetType("Ursa.Demo.Pages."+name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
- else
- {
- return new TextBlock { Text = "Not Found: " + name };
- }
+ return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object? data)
diff --git a/demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs b/demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs
index 783f47b..08724f8 100644
--- a/demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs
+++ b/demo/Ursa.Demo/Dialogs/DialogWithAction.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Dialogs;
diff --git a/demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs b/demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs
index 1e4be06..4110bb6 100644
--- a/demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs
+++ b/demo/Ursa.Demo/Dialogs/PlainDialog.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Dialogs;
diff --git a/demo/Ursa.Demo/Pages/AvatarDemo.axaml.cs b/demo/Ursa.Demo/Pages/AvatarDemo.axaml.cs
index 5bc2485..cffff7d 100644
--- a/demo/Ursa.Demo/Pages/AvatarDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/AvatarDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/BadgeDemo.axaml.cs b/demo/Ursa.Demo/Pages/BadgeDemo.axaml.cs
index eec79bf..7caa06c 100644
--- a/demo/Ursa.Demo/Pages/BadgeDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/BadgeDemo.axaml.cs
@@ -1,4 +1,3 @@
-using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
diff --git a/demo/Ursa.Demo/Pages/BannerDemo.axaml.cs b/demo/Ursa.Demo/Pages/BannerDemo.axaml.cs
index 72a772d..cd7b94d 100644
--- a/demo/Ursa.Demo/Pages/BannerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/BannerDemo.axaml.cs
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
-using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Markup.Xaml;
@@ -23,9 +22,9 @@ public partial class BannerDemo : UserControl
public class BannerDemoViewModel : ViewModelBase
{
- private ObservableCollection _types;
+ private ObservableCollection? _types;
- public ObservableCollection Types
+ public ObservableCollection? Types
{
get => _types;
set => SetProperty(ref _types, value);
diff --git a/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs b/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs
index c119fc7..1f63393 100644
--- a/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ButtonGroupDemo.axaml.cs b/demo/Ursa.Demo/Pages/ButtonGroupDemo.axaml.cs
index 533130a..5b00129 100644
--- a/demo/Ursa.Demo/Pages/ButtonGroupDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ButtonGroupDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
@@ -10,6 +8,6 @@ public partial class ButtonGroupDemo : UserControl
public ButtonGroupDemo()
{
InitializeComponent();
- this.DataContext = new ButtonGroupDemoViewModel();
+ DataContext = new ButtonGroupDemoViewModel();
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs b/demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs
index 30e502a..851cb7b 100644
--- a/demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ClassInputDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ClockDemo.axaml.cs b/demo/Ursa.Demo/Pages/ClockDemo.axaml.cs
index 058136a..3db30dd 100644
--- a/demo/Ursa.Demo/Pages/ClockDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ClockDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs b/demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs
index e38d30d..74214c7 100644
--- a/demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs
@@ -1,7 +1,5 @@
using System.Diagnostics;
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
using Ursa.Controls;
namespace Ursa.Demo.Pages;
@@ -13,12 +11,12 @@ public partial class DatePickerDemo : UserControl
InitializeComponent();
}
- private void CalendarView_OnOnDateSelected(object? sender, CalendarDayButtonEventArgs e)
+ private void CalendarView_OnOnDateSelected(object? _, CalendarDayButtonEventArgs e)
{
Debug.WriteLine("Pressed: "+ e.Date?.ToLongDateString());
}
- private void CalendarView_OnOnDatePreviewed(object? sender, CalendarDayButtonEventArgs e)
+ private void CalendarView_OnOnDatePreviewed(object? _, CalendarDayButtonEventArgs e)
{
Debug.WriteLine("Hovered: "+e.Date?.ToLongDateString());
}
diff --git a/demo/Ursa.Demo/Pages/DialogDemo.axaml.cs b/demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
index 2453f1a..ed838eb 100644
--- a/demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs b/demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs
index 68b6fbd..0476b6c 100644
--- a/demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/DisableContainerDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/DividerDemo.axaml.cs b/demo/Ursa.Demo/Pages/DividerDemo.axaml.cs
index bdd3bd4..9f3018a 100644
--- a/demo/Ursa.Demo/Pages/DividerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/DividerDemo.axaml.cs
@@ -1,4 +1,3 @@
-using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
diff --git a/demo/Ursa.Demo/Pages/DrawerDemo.axaml b/demo/Ursa.Demo/Pages/DrawerDemo.axaml
index 2429a65..96b1eac 100644
--- a/demo/Ursa.Demo/Pages/DrawerDemo.axaml
+++ b/demo/Ursa.Demo/Pages/DrawerDemo.axaml
@@ -2,7 +2,6 @@
x:Class="Ursa.Demo.Pages.DrawerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
diff --git a/demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs b/demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs
index 3aa8916..788fa0d 100644
--- a/demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/DrawerDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs b/demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs
index da6250a..a1bbd81 100644
--- a/demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/EnumSelectorDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/FormDemo.axaml.cs b/demo/Ursa.Demo/Pages/FormDemo.axaml.cs
index 64a5f0c..3881d9b 100644
--- a/demo/Ursa.Demo/Pages/FormDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/FormDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/IPv4BoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/IPv4BoxDemo.axaml.cs
index c3a050c..fc8b272 100644
--- a/demo/Ursa.Demo/Pages/IPv4BoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/IPv4BoxDemo.axaml.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Net;
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs b/demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs
index 4b2931d..bb07fc8 100644
--- a/demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/IconButtonDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs b/demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs
index 7aa908c..e558339 100644
--- a/demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ImageViewerDemo.axaml.cs
@@ -1,7 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Interactivity;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
index ba2bbbf..c292152 100644
--- a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
+++ b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml
@@ -2,7 +2,6 @@
x:Class="Ursa.Demo.Pages.IntroductionDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:Ursa.Demo.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
diff --git a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs
index ec1ee5c..2dab9c9 100644
--- a/demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/IntroductionDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml.cs b/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml.cs
index f213756..c5fc35f 100644
--- a/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/KeyGestureInputDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
@@ -10,9 +8,4 @@ public partial class KeyGestureInputDemo : UserControl
{
InitializeComponent();
}
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/Pages/LoadingDemo.axaml.cs b/demo/Ursa.Demo/Pages/LoadingDemo.axaml.cs
index cfbc0e8..65a17f2 100644
--- a/demo/Ursa.Demo/Pages/LoadingDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/LoadingDemo.axaml.cs
@@ -1,4 +1,3 @@
-using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
diff --git a/demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs
index 0b5cf40..cfdc4c9 100644
--- a/demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/MessageBoxDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs
index 2a51be5..9c67a7f 100644
--- a/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs
index eac27af..d1bae7d 100644
--- a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml.cs
@@ -1,9 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Controls.Shapes;
-using Avalonia.Input;
-using Avalonia.LogicalTree;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
@@ -13,15 +8,6 @@ public partial class NavMenuDemo : UserControl
public NavMenuDemo()
{
InitializeComponent();
- this.DataContext = new NavMenuDemoViewModel();
- }
-
- private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
- {
- if (sender is Rectangle c)
- {
- c.ApplyStyling();
- var ancestors = c.GetLogicalAncestors();
- }
+ DataContext = new NavMenuDemoViewModel();
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs b/demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs
index b82a6ae..8e3a09e 100644
--- a/demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/NumPadDemo.axaml.cs
@@ -1,7 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs b/demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
index 35df3ef..ea47763 100644
--- a/demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/NumberDisplayerDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml
index 75baa53..610c37a 100644
--- a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml
+++ b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml
@@ -55,7 +55,7 @@
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Left">
-
+
-
+
-
+
-
+
diff --git a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs
index 8ca1387..40e00de 100644
--- a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml.cs
@@ -1,7 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-using System;
+using Avalonia.Controls;
using System.Diagnostics;
using Ursa.Controls;
using Ursa.Demo.ViewModels;
@@ -19,7 +16,9 @@ public partial class NumericUpDownDemo : UserControl
private void Numd_ValueChanged(object? sender, ValueChangedEventArgs e)
{
- Trace.WriteLine($"{(sender as NumericUIntUpDown).Name} {e.OldValue} {e.NewValue}");
-
+ if (sender is NumericIntUpDown i)
+ {
+ Trace.WriteLine($"{i.Name} {e.OldValue} {e.NewValue}");
+ }
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/Pages/PaginationDemo.axaml.cs b/demo/Ursa.Demo/Pages/PaginationDemo.axaml.cs
index 3418732..0377132 100644
--- a/demo/Ursa.Demo/Pages/PaginationDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/PaginationDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/RangeSliderDemo.axaml.cs b/demo/Ursa.Demo/Pages/RangeSliderDemo.axaml.cs
index fe3181d..920b149 100644
--- a/demo/Ursa.Demo/Pages/RangeSliderDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/RangeSliderDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs b/demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs
index 5e7741c..1c57352 100644
--- a/demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ScrollToButtonDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs
index 60d5ccd..23ec21e 100644
--- a/demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/SelectionBoxDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TagInputDemo.axaml.cs b/demo/Ursa.Demo/Pages/TagInputDemo.axaml.cs
index f19dc0a..1a72bcd 100644
--- a/demo/Ursa.Demo/Pages/TagInputDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TagInputDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs b/demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs
index a8e48c6..85cabf1 100644
--- a/demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ThemeTogglerDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs
index 5811b1b..d5072b0 100644
--- a/demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TimeBoxDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs b/demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs
index 330eb98..182be59 100644
--- a/demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TimePickerDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TimelineDemo.axaml.cs b/demo/Ursa.Demo/Pages/TimelineDemo.axaml.cs
index fe07b76..a8f4819 100644
--- a/demo/Ursa.Demo/Pages/TimelineDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TimelineDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs b/demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs
index f9f0f8f..0fd3ee4 100644
--- a/demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/ToolBarDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs b/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs
index 6338466..6a6bc05 100644
--- a/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs b/demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs
index 72e0a25..c042fb4 100644
--- a/demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/TwoTonePathIconDemo.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.Demo.Pages;
diff --git a/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml b/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml
index 43e4ac8..77c7cd6 100644
--- a/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml
+++ b/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml
@@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
xmlns:vm="using:Ursa.Demo.ViewModels"
- xmlns:system="clr-namespace:System;assembly=System.Runtime"
x:DataType="vm:VerificationCodeDemoViewModel"
x:CompileBindings="True"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
diff --git a/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs b/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs
index 5933b5c..23f9bb0 100644
--- a/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs
+++ b/demo/Ursa.Demo/Pages/VerificationCodeDemo.axaml.cs
@@ -1,7 +1,4 @@
-using System;
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
using Ursa.Controls;
namespace Ursa.Demo.Pages;
@@ -13,7 +10,7 @@ public partial class VerificationCodeDemo : UserControl
InitializeComponent();
}
- private async void VerificationCode_OnComplete(object? sender, VerificationCodeCompleteEventArgs e)
+ private async void VerificationCode_OnComplete(object? _, VerificationCodeCompleteEventArgs e)
{
var text = string.Join(string.Empty, e.Code);
await MessageBox.ShowOverlayAsync(text);
diff --git a/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs
index d5dbbee..1e696b4 100644
--- a/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs
@@ -8,34 +8,29 @@ namespace Ursa.Demo.ViewModels;
public class BreadcrumbDemoViewModel: ObservableObject
{
- public ObservableCollection Items1 { get; set; }
-
- public BreadcrumbDemoViewModel()
- {
- Items1 = new ObservableCollection()
- {
- new BreadcrumbDemoItem() { Section = "Home", Icon = "Home" },
- new BreadcrumbDemoItem() { Section = "Page 1", Icon = "Page" },
- new BreadcrumbDemoItem() { Section = "Page 2", Icon = "Page" },
- new BreadcrumbDemoItem() { Section = "Page 3", Icon = "Page" },
- new BreadcrumbDemoItem() { Section = "Page 4", Icon = "Page", IsReadOnly = true},
- };
- }
+ public ObservableCollection Items1 { get; set; } =
+ [
+ new BreadcrumbDemoItem { Section = "Home", Icon = "Home" },
+ new BreadcrumbDemoItem { Section = "Page 1", Icon = "Page" },
+ new BreadcrumbDemoItem { Section = "Page 2", Icon = "Page" },
+ new BreadcrumbDemoItem { Section = "Page 3", Icon = "Page" },
+ new BreadcrumbDemoItem { Section = "Page 4", Icon = "Page", IsReadOnly = true }
+ ];
}
public partial class BreadcrumbDemoItem: ObservableObject
{
- public string Section { get; set; }
- public string Icon { get; set; }
+ public string? Section { get; set; }
+ public string? Icon { get; set; }
[ObservableProperty] private bool _isReadOnly;
public ICommand Command { get; set; }
public BreadcrumbDemoItem()
{
- Command = new RelayCommand(() =>
+ Command = new AsyncRelayCommand(async () =>
{
- MessageBox.ShowOverlayAsync(Section);
+ await MessageBox.ShowOverlayAsync(Section ?? string.Empty);
});
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/ViewModels/DialogDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/DialogDemoViewModel.cs
index 46e6c86..d966e9f 100644
--- a/demo/Ursa.Demo/ViewModels/DialogDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/DialogDemoViewModel.cs
@@ -4,10 +4,8 @@ using System.Threading.Tasks;
using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
-using Ursa.Common;
using Ursa.Controls;
using Ursa.Demo.Dialogs;
-using Ursa.Demo.Pages;
namespace Ursa.Demo.ViewModels;
diff --git a/demo/Ursa.Demo/ViewModels/EnumSelectorDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/EnumSelectorDemoViewModel.cs
index 06be6d4..5877b24 100644
--- a/demo/Ursa.Demo/ViewModels/EnumSelectorDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/EnumSelectorDemoViewModel.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
-using System.Windows.Input;
using Avalonia.Animation;
using Avalonia.Controls;
using Avalonia.Data;
@@ -9,7 +8,6 @@ using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
using CommunityToolkit.Mvvm.ComponentModel;
-using CommunityToolkit.Mvvm.Input;
namespace Ursa.Demo.ViewModels;
diff --git a/demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs
index 4f2d459..9ef65ed 100644
--- a/demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/FormDemoViewModel.cs
@@ -37,7 +37,7 @@ public partial class FormDemoViewModel : ObservableObject
public partial class DataModel : ObservableObject
{
- private string _name;
+ private string _name = string.Empty;
[MinLength(10)]
public string Name
@@ -55,7 +55,7 @@ public partial class DataModel : ObservableObject
set => SetProperty(ref _number, value);
}
- private string _email;
+ private string _email = string.Empty;
[EmailAddress]
public string Email
diff --git a/demo/Ursa.Demo/ViewModels/MainViewViewModel.cs b/demo/Ursa.Demo/ViewModels/MainViewViewModel.cs
index 4bd2bab..6d34758 100644
--- a/demo/Ursa.Demo/ViewModels/MainViewViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/MainViewViewModel.cs
@@ -1,4 +1,5 @@
-using CommunityToolkit.Mvvm.Messaging;
+using System;
+using CommunityToolkit.Mvvm.Messaging;
namespace Ursa.Demo.ViewModels;
@@ -67,6 +68,7 @@ public class MainViewViewModel : ViewModelBase
MenuKeys.MenuKeyToolBar => new ToolBarDemoViewModel(),
MenuKeys.MenuKeyTimeBox => new TimeBoxDemoViewModel(),
MenuKeys.MenuKeyVerificationCode => new VerificationCodeDemoViewModel(),
+ _ => throw new ArgumentOutOfRangeException(nameof(s), s, null)
};
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/ViewModels/MenuItemViewModel.cs b/demo/Ursa.Demo/ViewModels/MenuItemViewModel.cs
index 279fb52..04aa4d9 100644
--- a/demo/Ursa.Demo/ViewModels/MenuItemViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/MenuItemViewModel.cs
@@ -14,10 +14,10 @@ public enum ControlStatus
public class MenuItemViewModel: ViewModelBase
{
- public string MenuHeader { get; set; }
- public string MenuIconName { get; set; }
- public string Key { get; set; }
- public string Status { get; set; }
+ public string? MenuHeader { get; set; }
+ public string? MenuIconName { get; set; }
+ public string? Key { get; set; }
+ public string? Status { get; set; }
public bool IsSeparator { get; set; }
public ObservableCollection Children { get; set; } = new();
@@ -31,7 +31,7 @@ public class MenuItemViewModel: ViewModelBase
private void OnActivate()
{
- if (IsSeparator) return;
- WeakReferenceMessenger.Default.Send(Key);
+ if (IsSeparator || Key is null) return;
+ WeakReferenceMessenger.Default.Send(Key);
}
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/ViewModels/MessageBoxDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/MessageBoxDemoViewModel.cs
index e3a6d5c..a835796 100644
--- a/demo/Ursa.Demo/ViewModels/MessageBoxDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/MessageBoxDemoViewModel.cs
@@ -14,7 +14,7 @@ public class MessageBoxDemoViewModel: ObservableObject
private readonly string _shortMessage = "Welcome to Ursa Avalonia!";
private string _message;
- private string _title;
+ private string? _title;
public ICommand DefaultMessageBoxCommand { get; set; }
public ICommand OkCommand { get; set; }
diff --git a/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs
index 663b5f1..a4f4435 100644
--- a/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs
@@ -1,11 +1,8 @@
-using Avalonia.Controls;
-using Avalonia.Layout;
+using Avalonia.Layout;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Globalization;
-using Ursa.Controls;
-using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Ursa.Demo.ViewModels;
@@ -14,39 +11,36 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
private double _oldWidth = 300;
- [ObservableProperty] private bool _AutoWidth = true;
- [ObservableProperty] private double _Width = Double.NaN;
- [ObservableProperty] private uint _Value;
- [ObservableProperty] private string _FontFamily = "Consolas";
- [ObservableProperty] private bool _AllowDrag = false;
- [ObservableProperty] private bool _IsReadOnly = false;
+ [ObservableProperty] private bool _autoWidth = true;
+ [ObservableProperty] private double _width = double.NaN;
+ [ObservableProperty] private uint _value;
+ [ObservableProperty] private string _fontFamily = "Consolas";
+ [ObservableProperty] private bool _allowDrag;
+ [ObservableProperty] private bool _isReadOnly;
- [ObservableProperty] private Array _Array_HorizontalAlignment;
- [ObservableProperty] private HorizontalAlignment _HorizontalAlignment = HorizontalAlignment.Center;
+ [ObservableProperty] private Array _arrayHorizontalAlignment;
+ [ObservableProperty] private HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;
- [ObservableProperty] private Array _Array_HorizontalContentAlignment;
- [ObservableProperty] private HorizontalAlignment _HorizontalContentAlignment = HorizontalAlignment.Center;
- [ObservableProperty] private object? _InnerLeftContent = "obj:0x";
- [ObservableProperty] private string _Watermark = "Water mark showed";
- [ObservableProperty] private string _FormatString = "X8";
- [ObservableProperty] private Array _Array_ParsingNumberStyle;
- [ObservableProperty] private NumberStyles _ParsingNumberStyle = NumberStyles.AllowHexSpecifier;
- [ObservableProperty] private bool _AllowSpin = true;
- [ObservableProperty] private bool _ShowButtonSpinner = true;
+ [ObservableProperty] private Array _arrayHorizontalContentAlignment;
+ [ObservableProperty] private HorizontalAlignment _horizontalContentAlignment = HorizontalAlignment.Center;
+ [ObservableProperty] private object? _innerLeftContent = "obj:0x";
+ [ObservableProperty] private string _watermark = "Water mark showed";
+ [ObservableProperty] private string _formatString = "X8";
+ [ObservableProperty] private Array _arrayParsingNumberStyle;
+ [ObservableProperty] private NumberStyles _parsingNumberStyle = NumberStyles.AllowHexSpecifier;
+ [ObservableProperty] private bool _allowSpin = true;
+ [ObservableProperty] private bool _showButtonSpinner = true;
- [ObservableProperty] private UInt32 _Maximum = UInt32.MaxValue;
- [ObservableProperty] private UInt32 _Minimum = UInt32.MinValue;
- [ObservableProperty] private UInt32 _Step = 1;
+ [ObservableProperty] private UInt32 _maximum = UInt32.MaxValue;
+ [ObservableProperty] private UInt32 _minimum = UInt32.MinValue;
+ [ObservableProperty] private UInt32 _step = 1;
- [ObservableProperty] private bool _IsEnable = true;
+ [ObservableProperty] private bool _isEnable = true;
- [ObservableProperty] private string _CommandUpdateText = "Command not Execute";
-
- uint v = 0;
+ [ObservableProperty] private string _commandUpdateText = "Command not Execute";
+
[RelayCommand]
- // void Trythis()
void Trythis(uint v)
- // void Trythis(object v)
{
CommandUpdateText = $"Command Exe,CommandParameter={v}";
}
@@ -54,12 +48,9 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
public NumericUpDownDemoViewModel()
{
- Array_HorizontalContentAlignment = Enum.GetValues(typeof(HorizontalAlignment));
- Array_HorizontalAlignment = Enum.GetValues(typeof(HorizontalAlignment));
- Array_ParsingNumberStyle = Enum.GetValues(typeof(NumberStyles));
- NumericUIntUpDown numericUIntUpDown;
- TextBox textBox;
-
+ ArrayHorizontalContentAlignment = Enum.GetValues(typeof(HorizontalAlignment));
+ ArrayHorizontalAlignment = Enum.GetValues(typeof(HorizontalAlignment));
+ ArrayParsingNumberStyle = Enum.GetValues(typeof(NumberStyles));
}
partial void OnAutoWidthChanged(bool value)
@@ -74,10 +65,4 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
Width = _oldWidth;
}
}
-
- partial void OnValueChanging(uint oldValue, uint newValue)
- {
- // Console.WriteLine(oldValue);
- }
-
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs
index a64dc9c..748ec17 100644
--- a/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs
@@ -1,9 +1,6 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows.Input;
using Avalonia.Collections;
-using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Ursa.Demo.ViewModels;
diff --git a/demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs
index 7ee4274..2aa071a 100644
--- a/demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Ursa.Demo.ViewModels
+namespace Ursa.Demo.ViewModels
{
public class SkeletonDemoViewModel : ViewModelBase
{
diff --git a/demo/Ursa.Demo/ViewModels/TimeBoxDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/TimeBoxDemoViewModel.cs
index 729b6c5..38b0790 100644
--- a/demo/Ursa.Demo/ViewModels/TimeBoxDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/TimeBoxDemoViewModel.cs
@@ -1,5 +1,4 @@
using System;
-using System.Net;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
diff --git a/demo/Ursa.Demo/ViewModels/ToolBarDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/ToolBarDemoViewModel.cs
index 8a04c8a..ce1c71b 100644
--- a/demo/Ursa.Demo/ViewModels/ToolBarDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/ToolBarDemoViewModel.cs
@@ -23,21 +23,21 @@ public partial class ToolBarDemoViewModel : ObservableObject
{
Items = new()
{
- new ToolBarButtonItemViewModel() { Content = "New", OverflowMode = OverflowMode.AsNeeded },
- new ToolBarButtonItemViewModel() { Content = "Open" },
- new ToolBarButtonItemViewModel() { Content = "Save1" },
- new ToolBarButtonItemViewModel() { Content = "Save2" },
+ new ToolBarButtonItemViewModel { Content = "New", OverflowMode = OverflowMode.AsNeeded },
+ new ToolBarButtonItemViewModel { Content = "Open" },
+ new ToolBarButtonItemViewModel { Content = "Save1" },
+ new ToolBarButtonItemViewModel { Content = "Save2" },
new ToolBarSeparatorViewModel(),
- new ToolBarButtonItemViewModel() { Content = "Save3" },
- new ToolBarButtonItemViewModel() { Content = "Save4" },
- new ToolBarButtonItemViewModel() { Content = "Save5" },
- new ToolBarButtonItemViewModel() { Content = "Save6" },
- new ToolBarButtonItemViewModel() { Content = "Save7" },
+ new ToolBarButtonItemViewModel { Content = "Save3" },
+ new ToolBarButtonItemViewModel { Content = "Save4" },
+ new ToolBarButtonItemViewModel { Content = "Save5" },
+ new ToolBarButtonItemViewModel { Content = "Save6" },
+ new ToolBarButtonItemViewModel { Content = "Save7" },
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 ToolBarButtonItemViewModel { Content = "Save8" },
+ new ToolBarCheckBoxItemViweModel { Content = "Bold" },
+ new ToolBarCheckBoxItemViweModel { Content = "Italic", OverflowMode = OverflowMode.Never },
+ new ToolBarComboBoxItemViewModel { Content = "Font Size", Items = ["10", "12", "14"] }
};
}
}
@@ -49,41 +49,40 @@ public abstract class ToolBarItemViewModel : ObservableObject
public class ToolBarButtonItemViewModel : ToolBarItemViewModel
{
- public string Content { get; set; }
- public ICommand Command { get; set; }
+ public string? Content { get; set; }
+ public ICommand? Command { get; set; }
public ToolBarButtonItemViewModel()
{
- Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content); });
+ Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content ?? string.Empty); });
}
}
public class ToolBarCheckBoxItemViweModel : ToolBarItemViewModel
{
- public string Content { get; set; }
+ public string? Content { get; set; }
public bool IsChecked { get; set; }
- public ICommand Command { get; set; }
+ public ICommand? Command { get; set; }
public ToolBarCheckBoxItemViweModel()
{
- Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content); });
+ Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content ?? string.Empty); });
}
}
public class ToolBarComboBoxItemViewModel : ToolBarItemViewModel
{
- public string Content { get; set; }
- public ObservableCollection Items { get; set; }
+ public string? Content { get; set; }
+ public ObservableCollection? Items { get; set; }
- private string _selectedItem;
-
- public string SelectedItem
+ private string? _selectedItem;
+ public string? SelectedItem
{
get => _selectedItem;
set
{
SetProperty(ref _selectedItem, value);
- MessageBox.ShowOverlayAsync(value);
+ _ = MessageBox.ShowOverlayAsync(value ?? string.Empty);
}
}
}
diff --git a/demo/Ursa.Demo/ViewModels/VerificationCodeDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/VerificationCodeDemoViewModel.cs
index 5de9705..2b5cc51 100644
--- a/demo/Ursa.Demo/ViewModels/VerificationCodeDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/VerificationCodeDemoViewModel.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Input;
-using Avalonia.Collections;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Ursa.Controls;
diff --git a/demo/Ursa.Demo/Views/MainView.axaml.cs b/demo/Ursa.Demo/Views/MainView.axaml.cs
index 563f7ea..8ee2660 100644
--- a/demo/Ursa.Demo/Views/MainView.axaml.cs
+++ b/demo/Ursa.Demo/Views/MainView.axaml.cs
@@ -1,7 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Interactivity;
-using Avalonia.Styling;
namespace Ursa.Demo.Views;
@@ -11,14 +8,4 @@ public partial class MainView : UserControl
{
InitializeComponent();
}
-
- private void ToggleButton_OnIsCheckedChanged(object? sender, RoutedEventArgs e)
- {
- var app = Application.Current;
- if (app is not null)
- {
- var theme = app.ActualThemeVariant;
- app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
- }
- }
}
\ No newline at end of file
diff --git a/demo/Ursa.Demo/Views/MainWindow.axaml.cs b/demo/Ursa.Demo/Views/MainWindow.axaml.cs
index f6466c3..f5b4304 100644
--- a/demo/Ursa.Demo/Views/MainWindow.axaml.cs
+++ b/demo/Ursa.Demo/Views/MainWindow.axaml.cs
@@ -1,6 +1,3 @@
-using System;
-using Avalonia.Controls;
-using Avalonia.Interactivity;
using Ursa.Controls;
namespace Ursa.Demo.Views;
diff --git a/demo/Ursa.Demo/Views/SingleView.axaml.cs b/demo/Ursa.Demo/Views/SingleView.axaml.cs
index 7f65e88..5a20b4f 100644
--- a/demo/Ursa.Demo/Views/SingleView.axaml.cs
+++ b/demo/Ursa.Demo/Views/SingleView.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Views;
diff --git a/demo/Ursa.PrismDialogDemo/App.axaml.cs b/demo/Ursa.PrismDialogDemo/App.axaml.cs
index 9e71d4c..33ba459 100644
--- a/demo/Ursa.PrismDialogDemo/App.axaml.cs
+++ b/demo/Ursa.PrismDialogDemo/App.axaml.cs
@@ -1,5 +1,4 @@
using Avalonia;
-using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Prism.DryIoc;
using Prism.Ioc;
diff --git a/demo/Ursa.PrismDialogDemo/DefaultDialog.axaml.cs b/demo/Ursa.PrismDialogDemo/DefaultDialog.axaml.cs
index 8a778b4..3f8b624 100644
--- a/demo/Ursa.PrismDialogDemo/DefaultDialog.axaml.cs
+++ b/demo/Ursa.PrismDialogDemo/DefaultDialog.axaml.cs
@@ -1,6 +1,4 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
+using Avalonia.Controls;
namespace Ursa.PrismDialogDemo;
diff --git a/demo/Ursa.PrismDialogDemo/MainWindow.axaml.cs b/demo/Ursa.PrismDialogDemo/MainWindow.axaml.cs
index 6ae5519..b54548b 100644
--- a/demo/Ursa.PrismDialogDemo/MainWindow.axaml.cs
+++ b/demo/Ursa.PrismDialogDemo/MainWindow.axaml.cs
@@ -1,6 +1,5 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
-using DryIoc;
using Ursa.Controls;
using Ursa.Controls.Options;
using Ursa.PrismExtension;
@@ -22,7 +21,8 @@ public partial class MainWindow : Window
_drawerService = drawerService;
}
- private void OverlayDialogButton_OnClick(object? sender, RoutedEventArgs e)
+ // ReSharper disable once UnusedParameter.Local
+ private void OverlayDialogButton_OnClick(object? sender, RoutedEventArgs _)
{
_overlayDialogService.ShowModal("Default", null, null, new OverlayDialogOptions()
{
@@ -30,7 +30,8 @@ public partial class MainWindow : Window
});
}
- private void AloneDialogButton_OnClick(object? sender, RoutedEventArgs e)
+ // ReSharper disable once UnusedParameter.Local
+ private void AloneDialogButton_OnClick(object? sender, RoutedEventArgs _)
{
_aloneDialogService.ShowModal("Default", null, null, new DialogOptions()
{
@@ -38,7 +39,8 @@ public partial class MainWindow : Window
});
}
- private void DrawerButton_OnClick(object? sender, RoutedEventArgs e)
+ // ReSharper disable once UnusedParameter.Local
+ private void DrawerButton_OnClick(object? sender, RoutedEventArgs _)
{
_drawerService.ShowModal("Default", null, null, new DrawerOptions()
{
diff --git a/src/Ursa.PrismExtension/IUrsaOverlayDialogService.cs b/src/Ursa.PrismExtension/IUrsaOverlayDialogService.cs
index fd282e4..17ecc71 100644
--- a/src/Ursa.PrismExtension/IUrsaOverlayDialogService.cs
+++ b/src/Ursa.PrismExtension/IUrsaOverlayDialogService.cs
@@ -1,5 +1,4 @@
-using Avalonia.Controls;
-using Ursa.Controls;
+using Ursa.Controls;
namespace Ursa.PrismExtension;
diff --git a/src/Ursa.Themes.Semi/Controls/Badge.axaml b/src/Ursa.Themes.Semi/Controls/Badge.axaml
index 099384f..ff7ab9b 100644
--- a/src/Ursa.Themes.Semi/Controls/Badge.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Badge.axaml
@@ -70,7 +70,7 @@
diff --git a/src/Ursa.Themes.Semi/Controls/DatePicker.axaml b/src/Ursa.Themes.Semi/Controls/DatePicker.axaml
index 6ddb92c..ae353b1 100644
--- a/src/Ursa.Themes.Semi/Controls/DatePicker.axaml
+++ b/src/Ursa.Themes.Semi/Controls/DatePicker.axaml
@@ -1,7 +1,6 @@
diff --git a/src/Ursa.Themes.Semi/Controls/Dialog.axaml b/src/Ursa.Themes.Semi/Controls/Dialog.axaml
index ca5d11e..66a500a 100644
--- a/src/Ursa.Themes.Semi/Controls/Dialog.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Dialog.axaml
@@ -165,7 +165,6 @@
diff --git a/src/Ursa.Themes.Semi/Controls/IPv4Box.axaml b/src/Ursa.Themes.Semi/Controls/IPv4Box.axaml
index 4cd290f..1c9e18a 100644
--- a/src/Ursa.Themes.Semi/Controls/IPv4Box.axaml
+++ b/src/Ursa.Themes.Semi/Controls/IPv4Box.axaml
@@ -113,10 +113,10 @@
diff --git a/src/Ursa.Themes.Semi/Controls/NumberDisplayer.axaml b/src/Ursa.Themes.Semi/Controls/NumberDisplayer.axaml
index 7b34b4b..50c207e 100644
--- a/src/Ursa.Themes.Semi/Controls/NumberDisplayer.axaml
+++ b/src/Ursa.Themes.Semi/Controls/NumberDisplayer.axaml
@@ -1,7 +1,6 @@
diff --git a/src/Ursa.Themes.Semi/Controls/Pagination.axaml b/src/Ursa.Themes.Semi/Controls/Pagination.axaml
index f190de4..41cdecb 100644
--- a/src/Ursa.Themes.Semi/Controls/Pagination.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Pagination.axaml
@@ -74,13 +74,13 @@
diff --git a/src/Ursa.Themes.Semi/Controls/TimePicker.axaml b/src/Ursa.Themes.Semi/Controls/TimePicker.axaml
index b640b65..04e065b 100644
--- a/src/Ursa.Themes.Semi/Controls/TimePicker.axaml
+++ b/src/Ursa.Themes.Semi/Controls/TimePicker.axaml
@@ -1,7 +1,6 @@
diff --git a/src/Ursa.Themes.Semi/Controls/Timeline.axaml b/src/Ursa.Themes.Semi/Controls/Timeline.axaml
index 913e62c..b82087f 100644
--- a/src/Ursa.Themes.Semi/Controls/Timeline.axaml
+++ b/src/Ursa.Themes.Semi/Controls/Timeline.axaml
@@ -110,7 +110,7 @@