c# - silverlight listbox stackpanel items define background color by templated item value -


i want chang background color border or stackpanel binded item's value

 <controls:childwindow.resources>         <l:stringtocolorconverter x:key="converter"/>     </controls:childwindow.resources> ...                 <datatemplate>                     <stackpanel orientation="vertical">                          <border borderbrush="black" background="{binding cím, converter={staticresource converter}}"  x:name="hatter" borderthickness="4" cornerradius="20">                             <stackpanel style="{staticresource dolgozostack}"                                          margin="2,2,2,2">                                 <textblock text="{binding cím}" textwrapping="wrap" foreground="white" fontsize="13" textalignment="center" />                             </stackpanel>                         </border>                     </stackpanel>                 </datatemplate> 

and here converter:

    public class stringtocolorconverter:ivalueconverter         {             public object convert(object value, type targettype,            object parameter, cultureinfo culture)             {                 if (value.tostring().tolower() == "megvalósítás elindítva".tolower())                     return colors.green;                 else{                      solidcolorbrush mybrush=new solidcolorbrush(colors.red);                 return mybrush; }              }     } 

find working solidcolorbrush


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -