Skip to content

Commit 2ef3d99

Browse files
authored
Fix For ViewModelViewHost not working on WinUI projects (#3575)
1 parent 9d73fba commit 2ef3d99

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,14 @@ public class AutoDataTemplateBindingHook : IPropertyBindingHook
2323
/// <summary>
2424
/// Gets the default item template.
2525
/// </summary>
26-
[SuppressMessage("Design", "CA1307: Use the currency locale settings", Justification = "Not available on all platforms.")]
2726
public static Lazy<DataTemplate> DefaultItemTemplate { get; } = new(() =>
2827
{
2928
const string template = "<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " +
30-
"xmlns:xaml='clr-namespace:ReactiveUI;assembly=__ASSEMBLYNAME__'> " +
29+
"xmlns:xaml='clr-namespace:ReactiveUI'>" +
3130
"<xaml:ViewModelViewHost ViewModel=\"{Binding Mode=OneWay}\" VerticalContentAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" IsTabStop=\"False\" />" +
3231
"</DataTemplate>";
3332

34-
var assemblyName = typeof(AutoDataTemplateBindingHook).Assembly.FullName;
35-
assemblyName = assemblyName?.Substring(0, assemblyName.IndexOf(','));
36-
37-
return (DataTemplate)XamlReader.Load(template.Replace("__ASSEMBLYNAME__", assemblyName));
33+
return (DataTemplate)XamlReader.Load(template);
3834
});
3935

4036
/// <inheritdoc/>

src/ReactiveUI.Maui/Common/ReactiveUserControl.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ namespace ReactiveUI
7474
/// <typeparam name="TViewModel">
7575
/// The type of the view model backing the view.
7676
/// </typeparam>
77-
[SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")]
7877
public
79-
class ReactiveUserControl<TViewModel> :
78+
class ReactiveUserControl<TViewModel> :
8079
UserControl, IViewFor<TViewModel>
8180
where TViewModel : class
8281
{

0 commit comments

Comments
 (0)