Hello people of Stack Overflow. Recently, I've been working on a project in WinUi3, and I haven't been able to find a way to set the content of a Button to a StackPanel.
In WPF you could just do:
myButton.Content = myStackPanel
But in WinUi3, there is no Content property in a button. Here is a sample of the code I'm using:
StackPanel elementPanel = new StackPanel();
elementPanel.Orientation = Orientation.Horizontal;
element.Content = elementPanel; // This doesn't work.
foreach (var item in child.ChildNodes)
{
if (item.NodeType == HtmlNodeType.Element || item.NodeType == HtmlNodeType.Comment)
{
parseElement(item, elementPanel);
}
}