Fatih
Fatih

Reputation: 1145

Avalonia: How to add a Control to UserControl programmatically

I can do that on Grid well with Grid.Children.Add(...) But I can't figure out how can I add a control to UserControl programmatically.

Upvotes: 1

Views: 2428

Answers (1)

radoslawik
radoslawik

Reputation: 1202

In order to use the Children property, your control has to implement the IPanel interface. The easiest way to achieve that is to make Panel a base class for your UserControl.

Upvotes: 2

Related Questions