Tuesday, 15 February 2011

c# - Windows 8.1 ComboBox wrap Item text -



c# - Windows 8.1 ComboBox wrap Item text -

i have long string not feed in 1 line of combobox item.

how can create wrap items' text?

i tried not work in windows 8.1 unviseral app

this combobox

<combobox x:name="childrenagepickercombobox_0" style="{staticresource comboboxwrappable}" itemssource="{binding childrenageoptions}" displaymemberpath="displaytext" />

this style want apply in order wrap text

<style x:key="comboboxwrappable" targettype="combobox" basedon="{staticresource comboboxbase}"> <setter property="itemtemplate"> <setter.value> <datatemplate> <textblock textwrapping="wrap" minwidth="200" text="{binding}"/> </datatemplate> </setter.value> </setter> </style>

the result combobox has no text @ all, , no items display when open it.

what wrong datatemplate? not render items. render them if don't utilize datatemplate.

to sum comments don't see text because cannot utilize both displaymemberpath , itemtemplate. should remove displaymemberpath="displaytext" combobox , move text binding

<style x:key="comboboxwrappable" targettype="combobox" basedon="{staticresource comboboxbase}"> <setter property="itemtemplate"> <setter.value> <datatemplate> <textblock textwrapping="wrap" text="{binding displaytext}"/> </datatemplate> </setter.value> </setter> </style>

c# wpf windows xaml windows-8.1

No comments:

Post a Comment