我在Silverlight中有一个组合框,其itemssource与 CollectionView 的 CollectionViewSource 绑定。
I have a combobox in Silverlight, whose itemssource is bound with a CollectionView of CollectionViewSource.
我还向 CollectionView 添加了 GroupDescription 。
现在我需要显示 ComboBox 中的项目,并且还需要显示组头。
Now I need to display the items in ComboBox grouped and also need to display the group header.
在WPF中有 ComboBox.GroupStyle ,我可以在其中定义组头。
In WPF, there is ComboBox.GroupStyle where I can define the group header. Whats the way to do it in Silverlight?
感谢
推荐答案Silverlight组合框不支持分组。只需在绑定组合框之前对项进行排序,然后在组合框itemtemplate中显示组名和项名称就足够了?组合框项目将如下所示:
The Silverlight combobox does not support grouping. Would it be sufficient to just sort the items before binding the combobox and then displaying both the group name and the item name in the combobox itemtemplate? The combobox items would then look something like this:
类别:啤酒,名称:锚点Steam 类别:啤酒,名称:百威 类别:葡萄酒,名称:作品1 类别:葡萄酒,名称:Sassicaia
Category:Beer, Name: Anchor Steam Category:Beer, Name: Budweiser Category:Wine, Name: Opus 1 Category:Wine, Name: Sassicaia
更多推荐
如何显示Silverlight组合框中项目的组头?
发布评论