c# - Wpf dictionary appearance in listbox -
i'm working on pos scheme , i'm using dictionary count duplicates in products list. utilize next linq this:
selectedproducts.groupby(x => x).todictionary(g => g.key, g => g.count()); then bind dictionary listbox show waiter. problem though, way dictionary looks when binded listbox unclear.
the way appears is: [object, count]. there way can alter way dictionary appears in listbox?
thanks in advance!
you seek adding itemtemplate listbox:
<listbox itemssource="{binding path=yourdictionary}"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <label content="{binding path=value}"/> <label margin="5,0,0,0" content="{binding path=key}"/> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> c# wpf dictionary listbox
No comments:
Post a Comment