i have datagridtemplate
bound double value "averageweight". field doesn't have have decimal places can have maximum of 5 decimal places.
public double averageweight { { return _averageweight; } set { _averageweight = value; raisepropertychanged(() => averageweight); } }
the xaml is:
<datagridtemplatecolumn width="4*" header="avg. weight"> <datagridtemplatecolumn.celltemplate> <datatemplate> <label verticalalignment="center" content="{binding path=averageweight}"/> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn>
what want have these average weight values aligned @ decimal point without showing unnecessary trailing zeros. how can achieve this?
you either need pad out 0's using format string property on binding or build own ivalueconverter handle conversion using string.padleft give spaces.
this assumes using fixed width font, if aren't going have separate fractional , integer component of number , bind multiple text blocks.
Comments
Post a Comment