Initial commit

This commit is contained in:
alphafetus committed 2023-10-09 11:11:48 -04:00
commit 8c7e1b917f
180 files changed
+7747

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using PcgsInvUi.ViewModels;
namespace PcgsInvUi;
public class ViewLocator : IDataTemplate
{
public Control Build(object data)
{
var name = data.GetType().FullName!.Replace("ViewModel", "View");
var type = Type.GetType(name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object data)
{
return data is ViewModelBase;
}
}