我正在尝试创建一个自定义WPF控件并将其放在StackPanel
我的XAML文件中.我最初做了一个自定义,UserControl
并收到以下错误消息:
A value of type 'CustomControl' cannot be added to a collection or dictionary of type 'UIElementCollection'.
Run Code Online (Sandbox Code Playgroud)
我尝试将自定义控件从a更改UserControl
为a UIElement
,但我仍然收到此消息.如何制作我可以放置在其中的自定义控件StackPanel
?