Use XAML to define the Render method of components (Code-Behind pattern)
Closed this issue · 2 comments
montyclt commented
Hello, I have a question / proposal.
Is possible define the Render
method in XAML instead in class?
I prefer write:
MyButton.cs
public partial class MyButton : Component<MyButton.Props, MyButton.State>
{
class Props {...}
public MyButton() : base(new Props { }) {...}
}
MyButton.cs.xaml
<button class="my-button">{Binding children}</button>
Instead of:
public partial class MyButton : Component<MyButton.Props, MyButton.State>
{
class Props {...}
public MyButton() : base(new Props { }) {...}
public ReactElement Render()
{
return Dom.Button(
new Attributes { },
this.children
);
}
}
There are any plans for support XAML?
Thanks you!
ProductiveRage commented
I think that there would need to be support in the Bridge compiler to support xaml and I'm not aware of them having any plans on that front.
If I'm being stupid and there is a way for Visual Studio to translate the xaml into regular .cs content that the Bridge compiler will then translate into JavaScript then it may be possible.. feel free to reopen the issue, if so!
montyclt commented
As I know, a xaml file is compiled into CRL class that initialize as properties its children, but I'm not really sure.