对列表框使用多个模板
我的 silverlight 代码中有一个列表框:
<ListBox x:Name="recepiesList" ItemsSource="{Binding recepiesList}" ItemTemplate="{StaticResource ListViewModelTemplate}" SelectionChanged="recepiesList_SelectionChanged" >
</ListBox>
问题是我必须在列表顶部有另一种类型的列表框项目(一种标题)。我找到了多种方法来使列表框具有多个模板,但对于这种微小的更改来说它们似乎很复杂。
有没有办法将列表框项包含到已应用模板的列表框中?
更新澄清我问这个问题是因为我想更好地利用该平台(对它来说是新手);我不知道xaml中的模板有什么限制,我只是在寻找更好的解决方案。
我正在寻找一种方法来做这样的事情:
列表框类型A
列表框类型B
列表框类型B
列表框类型B
列表框类型B
列表框类型B
并且由于我有一些关于 listboxtype A 的明确信息(它是列表中的第一个并且只出现一次),我认为它可以通过“添加”以某种方式交入 XAML。
i have a listbox in my silverlight code :
<ListBox x:Name="recepiesList" ItemsSource="{Binding recepiesList}" ItemTemplate="{StaticResource ListViewModelTemplate}" SelectionChanged="recepiesList_SelectionChanged" >
</ListBox>
the thing is that i have to have another type of listboxitem at the top of the list ( a sort of header ) . i've found multiple ways to have listbox's with multiple templates but they seem to complex for this sort of minor change.
Is there a way to include a listboxitem to a listbox that has a applied template?
UPDATE FOR CLARIFICATION I am asking this question because i am trying to take better advantage of the platform (being new to it); i don't know what the limitations of the templates in xaml are, i'm just looking for a better solution.
i am looking for a way to do something like this :
listboxtype A
listboxtype B
listboxtype B
listboxtype B
listboxtype B
listboxtype B
and due to the fact that i have some explicit information about listboxtype A (it's the first in the list and it only appears once), i was thinking that it could be added 'by hand' in XAML in some way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 @abhinav 建议的那样,我使用了 longlistpicker 并且能够添加自定义标头模板
As @abhinav suggested, i used a longlistpicker and was able to add a custom header template