Any way to pass a parameter to a window in avalonia? #15285
Replies: 1 comment 1 reply
-
just add another parameterless constuctor: public TestWindow(string mode="") : this()
{
// do your stuff
}
public TestWindow() // maybe internal is enough, up to you to test
{
InitializeComponent();
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to pass a parameter to a window in avalonia, but doing so causes the design view to break with the error:
System.Xaml.XamlException: Cannot compile Build method. Parameters mismatch. Type needs to have a parameterless ctor or a ctor with a single IServiceProvider argument. Or x:Arguments directive with matching arguments needs to be set.
The code like:
public partial class TestWindow: Window { public TestWindow(string mode="") { InitializeComponent(); } }
Beta Was this translation helpful? Give feedback.
All reactions