wpf - DataTrigger C# in resourceDictionary -
i have searched topics on stackoverflow, none seem work me.
i set datagrid columns based on columns in resourcedictionary. (this dictionary consists of datagridtemplatecolumn's.) 1 of these columns contains binding boolean value. not want 'true' or 'false', want have '√' or ''.
this not seem work me (datatrigger textblock). still keeps 'true' or 'false'.
this textblock inside template:
<textblock text="{binding booleanvalue}" textalignment="center"> <textblock.style> <style targettype="{x:type textblock}"> <style.triggers> <datatrigger binding="{binding booleanvalue}" value="true"> <setter property="text" value="√"/> </datatrigger> <datatrigger binding="{binding booleanvalue}" value="false"> <setter property="text" value=""/> </datatrigger> </style.triggers> </style> </textblock.style> </textblock>
what missing or should change?
your datatrigger not change value of text property because set inside textblock declaration. so, once setted, never changed. allow changing, have set value inside style.
Comments
Post a Comment