diff --git a/SukiUI.Demo/Common/ViewLocator.cs b/SukiUI.Demo/Common/ViewLocator.cs index c9d0a5302..4f12def8b 100644 --- a/SukiUI.Demo/Common/ViewLocator.cs +++ b/SukiUI.Demo/Common/ViewLocator.cs @@ -12,23 +12,23 @@ public class ViewLocator : IDataTemplate public Control Build(object? data) { - var fullName = data?.GetType().FullName; - if (fullName is null) - { - return new TextBlock { Text = "Data is null or has no name." }; - } + if(data is null) + return new TextBlock { Text = "Data is null." }; + + var fullName = data.GetType().FullName; + + if (string.IsNullOrWhiteSpace(fullName)) + return new TextBlock { Text = "Type has no name, or name is empty." }; var name = fullName.Replace("ViewModel", "View"); var type = Type.GetType(name); if (type is null) - { return new TextBlock { Text = $"No View For {name}." }; - } - if (!_controlCache.TryGetValue(data!, out var res)) + if (!_controlCache.TryGetValue(data, out var res)) { res ??= (Control)Activator.CreateInstance(type)!; - _controlCache[data!] = res; + _controlCache[data] = res; } res.DataContext = data; diff --git a/SukiUI.Demo/Features/ControlsLibrary/TabControl/TabControlView.axaml b/SukiUI.Demo/Features/ControlsLibrary/TabControl/TabControlView.axaml index 43e7673fd..d2d588e29 100644 --- a/SukiUI.Demo/Features/ControlsLibrary/TabControl/TabControlView.axaml +++ b/SukiUI.Demo/Features/ControlsLibrary/TabControl/TabControlView.axaml @@ -65,6 +65,16 @@ + + + + + + + + + + diff --git a/SukiUI/Theme/TabControl.axaml b/SukiUI/Theme/TabControl.axaml index a420bf404..49ac2c187 100644 --- a/SukiUI/Theme/TabControl.axaml +++ b/SukiUI/Theme/TabControl.axaml @@ -28,7 +28,7 @@ @@ -42,7 +42,24 @@ + + + + + + +