c# - ItemsControl, on binding text cuts down from end -
iam working on win 8.1app. have datatemplate
<datatemplate x:key="radiooptiondatatemplate"> <grid horizontalalignment="left"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <textblock style="{staticresource subtitletextblockstyle}" margin="0 0 0 15"> <run text="{binding name}"/><run text=":"/> </textblock> <itemscontrol grid.row="1" itemssource="{binding getoptions}"> <itemscontrol.itemtemplate> <datatemplate> <radiobutton content="{binding}" margin="0 0 10 10" ischecked="true"/> </datatemplate> </itemscontrol.itemtemplate> <itemscontrol.itemspanel> <itemspaneltemplate> <itemswrapgrid orientation="horizontal"/> </itemspaneltemplate> </itemscontrol.itemspanel> </itemscontrol> </grid> </datatemplate>
it show data this
now if see text cuts down right end. if set static content of radio button looks well.
i want know why happening in case of binding.
itemscontrol item's widths calculating based on how size has it's first item needs. in code 'no rice' first item text & second , third item texts longer first item text. because text wraps.
and if set first item text longer , other items fit in view & text not cut off.
you can use text wrapping 1 method avoiding text cut off. or have create items control variable item widths.
please check following link creating grid view variable item width
how display gridview items variable width in window 8?
thanks
Comments
Post a Comment