如何在xaml中向Accordion添加多个用户控件
我正在使用带有 Accordion 的 Silverlight 4 页面,我试图向每个 Accordion 项目插入 2 个用户控件。
<toolkit:Accordion Name="accordion1">
<toolkit:AccordionItem Content="item 1" Header="A">
<local:AddRemoveControl x:Name="AddRemoveAgents" Margin="470,90,0,0"> </local:AddRemoveControl>
</toolkit:AccordionItem>
<toolkit:AccordionItem Content="item 2" Header="B - long header">
<local:DatesFilter x:Name="DatesFilter" Margin="475,200,0,0" Canvas.Top="76"> </local:DatesFilter>
</toolkit:AccordionItem>
</toolkit:Accordion>
我收到以下错误消息:“属性内容设置多次”
我该如何继续?
谢谢你!
I'm using a Silverlight 4 page with an Accordion to which I'm trying to insert 2 user controls to each Accordion item.
<toolkit:Accordion Name="accordion1">
<toolkit:AccordionItem Content="item 1" Header="A">
<local:AddRemoveControl x:Name="AddRemoveAgents" Margin="470,90,0,0"> </local:AddRemoveControl>
</toolkit:AccordionItem>
<toolkit:AccordionItem Content="item 2" Header="B - long header">
<local:DatesFilter x:Name="DatesFilter" Margin="475,200,0,0" Canvas.Top="76"> </local:DatesFilter>
</toolkit:AccordionItem>
</toolkit:Accordion>
I'm getting the following error message: "The property content is set more than once"
How can I proceed?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
手风琴中只能有一个内容项。
您需要做的是将控件包装在 StackPanel 中:
You can only have one content item in an accordion.
What you will need to do is wrap your controls in a StackPanel:
这是我更新的代码:
Here is my updated code:
您正在两次定义内容。尝试从 AccordionItem 中删除内容标签,如下所示:
另外,按照当前的方式,您最终将得到两个 Accordion 项目,每个项目中都有一个控件。要将两个控件放在同一个项目中,您需要将第二个控件放在第一个堆栈面板中。
You are defining the content twice. Try removing the content tags from the AccordionItem like this:
Also, the way you have it currently you will end up with two Accodion items with one control in each. To get both the controls in the same item you need to put the second control in the first stackpanel.