将一个 MAUI-C# 控件转换为 XAML 字符串。

huangapple go评论65阅读模式
英文:

Convert a MAUI-C# control to xaml-string

问题

这是您要翻译的内容:

"i know i can load a control from xaml-code like this:

string navigationButtonXAML = "<Button Text=&quot;Navigate&quot; />";
Button navigationButton = new Button().LoadFromXaml(navigationButtonXAML);

But is it possible to covert my C# control to xaml, in the end it should look somehow like this:

string myControl = new MyControl.WriteToXAML();"

请注意,代码部分未被翻译。

英文:

i know i can load a control from xaml-code like this:

string navigationButtonXAML = &quot;&lt;Button Text=\&quot;Navigate\&quot; /&gt;&quot;;
Button navigationButton = new Button().LoadFromXaml(navigationButtonXAML);

But is it possible to covert my C# control to xaml, in the end it should look somehow like this:

string myControl = new MyControl.WriteToXAML();

答案1

得分: 0

No, it can't covert C# control to xaml in MAUI or Xamarin.

I tested the code and searched related content about it, but there is no workaround to achieve it.

For more info about XAML, you can refer to the official doc.

英文:

>But is it possible to covert my C# control to xaml, in the end it should look somehow like this: string myControl = new MyControl.WriteToXAML();

No, it can't covert C# control to xaml in MAUI or Xamarin.

I tested the code and searched related content about it, but there is no workaround to achieve it.

For more info about XAML, you can refer to the official doc.

huangapple
  • 本文由 发表于 2023年3月31日 22:00:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75899408.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定