I have a Border.
I have a TextBlock displayed on it:
TextBlock tb = new TextBlock();
myBorder.Child = tb;
And it works fine.
The thing is: I also want to have CheckBox displayed on it.
The problem is that border is a single child element.
Is there any workaround here?
Thank you!
The problem is that border is a single child element...
Correct, Border is a ContentControl and they, by design, can only contain 1 child.
So... is there any workaround here?
Yes, just place a Grid, StackPanel or any other LayoutControl (Panel) inside the Border. This is a general approach that lets you create arbitrary complex content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With