c# - XAML - Change icon dependent on binding -
i'm creating listview , binding data, working ok, can't work out how change icon based on data value.
<border background="aquamarine" grid.column="0"> <symbolicon symbol="folder" horizontalalignment="center" margin="10"/> </border> <border background="yellow" grid.column="1"> <textblock text="{binding fname}" margin="5" /> </border>
so symbolicon folder how change icon if underlying data set has boolean value denoting folder false?
in fact there way of changing other styling in following textblock, based on actual data underlying field?
you can change symbol
based on bool
property binding using ivalueconverter
. have ivalueconverter
convert true
"folder" , false
"somethingelse" (whatever icon want false).
the binding like:
<symbolicon symbol="{binding path=thebooleanproperty, converter=nameoftheivalueconverterresource" horizontalalignment="center" margin="10"/>
Comments
Post a Comment