c# - How to make header style colors of a PivotItems with MVVM -


i want current header blue, , others red. problem headers in code not pivotitem.header, of type binded itemssource. know have write property in viewmodel , bind foreground property of textbox, header of pivotitem cannot figure out how?

here xaml:

<pivot foreground="#ff888888" style="{staticresource pivotstyle1}" grid.row="1" itemtemplate="{binding viewdatatemplate}" itemssource="{binding viewdatasource}">         <pivot.headertemplate>             <datatemplate>                 <grid>                     <textblock text="{binding id}" margin="0, 16, 0, 0" foreground="?????????" fontsize="32" fontfamily="segoe wp" fontweight="light"/>                 </grid>             </datatemplate>         </pivot.headertemplate>         <pivot.itemcontainerstyle>             <style targettype="pivotitem">                 <setter property="margin" value="8, 8, 8, 0"/>             </style>         </pivot.itemcontainerstyle>     </pivot> 

how write property in viewmodel , bind foreground="?????????", desired effect?

i tried in page code-behind, not work because e.addeditems[0] not pivotitem type, , currentitem null:

private void mypivot_selectionchanged(object sender, selectionchangedeventargs e)     {         if (0 < e.addeditems.count)         {             pivotitem currentitem = e.addeditems[0] pivotitem;              if (null != currentitem)             {                 if (null != currentitem.header)                 {                     (currentitem.header textblock).foreground = new solidcolorbrush(colors.red);                 }             }         }          if (0 < e.removeditems.count)         {             pivotitem currentitem = e.removeditems[0] pivotitem;              if (null != currentitem)             {                 if (null != currentitem.header)                 {                     (currentitem.header textblock).foreground = new solidcolorbrush(colors.blue);                 }             }         }     } 


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -