feat: clean up warnings.
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user