如何在标签上分组组合框项目 [英] How Can I Group Combo Box Item On Label

查看:68
本文介绍了如何在标签上分组组合框项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的wpf应用程序中,我有5个组合框(CB),每个CB绑定10项(A,B,C,D,E,F,G,H,I,J)并且还有动态生成label(将显示组合框项目组)。

所以问题是,当用户选择所有组合框项目时,它显示为所选项目的分组。



例如:



您选择



A

B

D

F

G

来自combobox。

in My wpf application,i have 5 Combo-box (CB), and each CB bind 10 item (A,B,C,D,E,F,G,H,I,J) AND also have dynamic generated label (which will show group of combo box item).
so question is that when user select all combobox item then its show as grouping of this selected item.

example :

You are select

A
B
D
F
G
from combobox.

推荐答案

<html>
<body>
<form name="form2" method="post" action="">
<select name="select1">
<optgroup id="optg1">
    <option id="opt1_1">first</option>
    <option>second</option>
    <option>third</option>
</optgroup>
<optgroup id="optg2">
    <option>first item in second group </option>
    <option id="opt2_2">second item in second group </option>
    <option>third item in second group </option>
</optgroup>
<script language="JavaScript">
    document.getElementById("optg1").label = "first group";
    document.getElementById("optg2").label = "second group";
</script>
</select>
</form>
</body>
</html>


在第一个Collect All Combo框中选择List in List然后分组



In first Collect All Combo box selected Value in List then Grouping that

var grouped = stuList.GroupBy(s => s.CollectedValue, m => m.count).Select(group => new { Cloth = group.Key,Total = group.Sum() });
                               listcal.ItemsSource = grouped;


这篇关于如何在标签上分组组合框项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆