I changed my UserControl to be a ReactiveUserControl and now I can't view the Design View. Is there anything I can do to get the designer to work with ReactiveUserControl?
Asked
Active
Viewed 1,355 times
1 Answers
13
The Visual Studio designer has issues when your control or window directly inherits from a generic class. This was a pretty common issue with WinForms as well. You can work around this issue by defining another non-generic class that sits between the generic ReactiveUserControl
and your control:
public partial class MyUserControl : MyUserControlBase
{
public MyUserControl()
{
InitializeComponent();
}
}
public abstract class MyUserControlBase: ReactiveUserControl<MyUserControlViewModel>
{
}
In the XAML, our root object element is defined as the base element (MyUserControlBase
) and its class declaration is connected to the partial class defined above (MyUserControl
):
<myNameSpace:MyUserControlBase
x:Class="MyNameSpace.MyUserControl"
xmlns:myNameSpace="clr-namespace:MyNameSpace"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

Community
- 1
- 1

Eugene Pawlik
- 1,170
- 1
- 15
- 21
-
1Just to add after editing you may get a "The name "MyUserControlBase" does not exist in namespace "clr-namespace:********". Make sure and rebuild project after changes. – JMIII Jun 25 '19 at 14:19