c# - Alteration Color Change for Listbox -


i have listbox , want change color of every other row. have tested following code, colors not changing. missing something?

<listbox height="250" borderthickness="0" itemssource="{binding path=results}" alternationcount="2">                 <listbox.itemtemplate>                     <datatemplate>                         <grid>                             <grid.columndefinitions>                                 <columndefinition></columndefinition>                                 <columndefinition></columndefinition>                                 <columndefinition></columndefinition>                             </grid.columndefinitions>                             <textblock grid.column="0" fontfamily="sagoe ui" fontsize="14" text="{binding firstname, stringformat='user: {0}'}" padding="2"  />                             <textblock grid.column="1" fontfamily="sagoe ui" fontsize="14" text="{binding company, stringformat='company: {0}'}" padding="2" />                              <textblock grid.column="2" fontfamily="sagoe ui" fontsize="14" text="{binding dept, stringformat='department: {0}'}" padding="2" >                                                             </textblock>                         </grid>                                             </datatemplate>                 <listbox.itemtemplate> 

here style , closing tags resoruces , dictionary

        <style  targettype="{x:type listboxitem}">             <style.triggers>                 <trigger property="itemscontrol.alternationindex" value="0">                     <setter property="background" value="#19f39611"></setter>                 </trigger>                 <trigger property="itemscontrol.alternationindex" value="1">                     <setter property="background" value="#19000000"></setter>                 </trigger>             </style.triggers>         </style>     </resourcedictionary> </usercontrol.resources> 

wow forgot using radlistbox, answer change opening , closing control tags

 <telerik:radlistbox></telerik:radlistbox> 

then

     <style  targettype="{x:type telerik:radlistboxitem}">             <style.triggers>                 <trigger property="itemscontrol.alternationindex" value="0">                     <setter property="background" value="#19f39611"></setter>                 </trigger>                 <trigger property="itemscontrol.alternationindex" value="1">                     <setter property="background" value="#19000000"></setter>                 </trigger>             </style.triggers>         </style>     </resourcedictionary> </usercontrol.resources> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -