我想要创建一个自定义的WPF控件,并将其放置在XAML文件中的StackPanel
中。我最初创建了一个自定义的UserControl
,并收到以下错误信息:
A value of type 'CustomControl' cannot be added to a collection or dictionary of type 'UIElementCollection'.
我尝试将我的自定义控件从UserControl
更改为UIElement
,但是我仍然收到这个消息。如何创建一个可以放置在StackPanel
中的自定义控件?