-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create an instance of "ReactiveUserControl`1" #1853
Comments
I have the same issue. |
I don't think is one we will necessarily be able to fix easily. The xaml editor is notorious for breaking easily. Hopefully with wpf being made open source now there will be some love to the xaml editor. |
For what I saw happening was that I dont't know if this is a cause or a symptom. But i have no experience in the xaml code generation corner of c# development, nor had the time to look into it. |
So ... That means ReactiveUserControl is useless ? Or how can i use ReactiveUserControl with working XAML Designer? Is there any workaround? |
I'm using ReactiveUserControl extensively and my small workaround is the following pattern: public class MyViewBase : ReactiveUserControl<MyViewModel>{ }
public class MyView : MyViewBase
{
// Actual Implementation
} (in xaml) <MyViewBase x:Class="MyView">
...
</MyViewBase> |
Ok,
So can we use XAML 2009? I guess, we are all trying to use it in an UWP project where unfortunately generics in xaml are not supported.
|
So i guess that the workaround of @jasonwurzel is the best we can get. |
@jorisvergeer @jasonwurzel Noice... I'll try it 👍 |
@jasonwurzel Well ... Can you please more describe your workaround? |
Ok ... It's working now. <views:MyViewBase
xmlns:views="clr-namespace:WavinModbusTester.Views"
x:Class="MyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:viewmodel="clr-namespace:WavinModbusTester.ViewModels"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Label Content="Hello World" FontSize="30"/>
</Grid>
</views:MyViewBase> View CS using ReactiveUI;
using WavinModbusTester.ViewModels;
namespace WavinModbusTester.Views
{
public class MyViewBase : ReactiveUserControl<TestControlViewModel> { }
public class MyView : MyViewBase
{
// Actual Implementation
}
} |
It might be useful to add an entry in the docs for this class. |
The code example in the comments in |
We welcome PR on the website project. |
I might write some later this week |
Potentially related to this issue. |
Going to close this one, since there are workarounds presented, documentation has been changed, and more of a WPF visual studio bug. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
XAML Designer not working
But compilation work.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Simply create Reactive User Control
What is the expected behavior?
Working XAML Designer
What is the motivation / use case for changing the behavior?
...
Which versions of ReactiveUI, and which platform / OS are affected by this issue? Did this work in previous versions of ReativeUI? Please also test with the latest stable and development snapshot
ReactiveUI 9.4.1
Visual Studio 2017 CE 15.9.3
Net Framework 4.7.2
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Control XAML
Control CS
Control ViewModel
XAML Designer StackTrace
The text was updated successfully, but these errors were encountered: