From 2ef3d9956e51e7854068c4618bdd89862ff4ab71 Mon Sep 17 00:00:00 2001 From: Chris Pulman Date: Sat, 8 Jul 2023 10:41:22 +0100 Subject: [PATCH] Fix For ViewModelViewHost not working on WinUI projects (#3575) --- src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs | 8 ++------ src/ReactiveUI.Maui/Common/ReactiveUserControl.cs | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs b/src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs index 571c98fc60..4f576813c3 100644 --- a/src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs +++ b/src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs @@ -23,18 +23,14 @@ public class AutoDataTemplateBindingHook : IPropertyBindingHook /// /// Gets the default item template. /// - [SuppressMessage("Design", "CA1307: Use the currency locale settings", Justification = "Not available on all platforms.")] public static Lazy DefaultItemTemplate { get; } = new(() => { const string template = " " + + "xmlns:xaml='clr-namespace:ReactiveUI'>" + "" + ""; - var assemblyName = typeof(AutoDataTemplateBindingHook).Assembly.FullName; - assemblyName = assemblyName?.Substring(0, assemblyName.IndexOf(',')); - - return (DataTemplate)XamlReader.Load(template.Replace("__ASSEMBLYNAME__", assemblyName)); + return (DataTemplate)XamlReader.Load(template); }); /// diff --git a/src/ReactiveUI.Maui/Common/ReactiveUserControl.cs b/src/ReactiveUI.Maui/Common/ReactiveUserControl.cs index b8c907171b..0854ed3dc4 100644 --- a/src/ReactiveUI.Maui/Common/ReactiveUserControl.cs +++ b/src/ReactiveUI.Maui/Common/ReactiveUserControl.cs @@ -74,9 +74,8 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// - [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] public - class ReactiveUserControl : + class ReactiveUserControl : UserControl, IViewFor where TViewModel : class {