diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-07 19:30:57 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-07 19:30:57 +0800 |
| commit | 3f8e818b58127a2fad66ed67032344f553632c38 (patch) | |
| tree | 8f8bd06593fb4b8ced1d485cb85c879dc5fb381f /JVDesktop/ViewLocator.cs | |
| parent | 088a09bbfd9bf8ebcdf3dd193cef688f37efe3c5 (diff) | |
Add Avalonia Project
Diffstat (limited to 'JVDesktop/ViewLocator.cs')
| -rw-r--r-- | JVDesktop/ViewLocator.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/JVDesktop/ViewLocator.cs b/JVDesktop/ViewLocator.cs index f289d15..6015998 100644 --- a/JVDesktop/ViewLocator.cs +++ b/JVDesktop/ViewLocator.cs @@ -7,12 +7,11 @@ namespace JVDesktop; public class ViewLocator : IDataTemplate { - public Control? Build(object? param) { if (param is null) return null; - + var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); var type = Type.GetType(name); @@ -20,7 +19,7 @@ public class ViewLocator : IDataTemplate { return (Control)Activator.CreateInstance(type)!; } - + return new TextBlock { Text = "Not Found: " + name }; } |
