c# - Displaying an image based on value in XAML -


this question has answer here:

how can display image based on value in xaml?

i have gender enumeration

[datacontract(name = "gender")] public enum genderenum {     [enummember] notspecified,     [enummember] male,     [enummember] female, } 

at model class have property of enumeration type called "gender". want display image based on value of "gender" via xaml side.

xaml:

   <image tag="{binding gender}" width="48" height="48">       <image.style>         <style targettype="image">             <style.triggers>                 <datatrigger  binding="{binding gender}" value="male">                     <setter property="source" value="/resources/client_male.png"/>                 </datatrigger >                 <datatrigger  binding="{binding gender}" value="female">                     <setter property="source" value="/resources/client_female.png"/>                 </datatrigger >             </style.triggers>         </style>       </image.style>      </image> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -