我想创建(相当于)一个自定义ItemsControl
,其中Item
s 放置在 a 中StackPanel
,与其他一些控件混合,比如 a Button
。所以,我希望以下在布局方面是等效的:
<StackPanel>
<Button>OK</Button>
<TextBox>Hello</TextBox>
<Button>OK</Button>
<TextBox>World</TextBox>
</StackPanel>
和
<CustomControlInQuestion>
<TextBox>Hello</TextBox>
<TextBox>World</TextBox>
</CustomControlInQuestion>
我走的所有替代道路(ItemContainer
s,ItemTemplate
s,custom Panel
s)都未能产生这种行为。有没有什么技术可以做到这一点?
可能值得强调的是,我确实需要将其作为自定义控件 :)
谢谢!