Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Create new xamGrid style
posted

Hi, i would like to create new style to the xamGrid.

I have taken the original styles from Blend, and copied the to my solution style file.

I don't want to change nothing on the original styles (I want them to stay as main style of my default grid in the system).

So i have created second copy for each style and Data Template from the original grid and added a "x:Key" to each.

What i want to achieve in mY new style is:

1) To change the background color of all grid headers to silver (including the row numbers header).

2) To change the color of the grid rows (one Blue, the second Red, for all rows on the grid..)

3) To change the color on run time for each Row that selected, and to each row that mouse just hover it. 

I think i have found the Data Template that responsible of the headers background color, but i now know which property in the grid's main style i need to change it's style to look at the key of the changed Data Template..

Can you please add an solution example that achieving all my goals?

Itsik

 

Parents
  • 138253
    Offline posted

    Hello Itsik,

     

    Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want.

     

    1)      I created a Style for the HeaderCellControl and RowSelectorHeaderCellControl and set their Background to Silver.

    2)      I copied the default Style of the CellControl and changed the Brushes that are used for the regular (CellItemNormalBackgroundBrush) and alternated CellItemAltNormalBackgroundBrush color. I do the same for the RowSelectorCellControl as well.

    3)      Change the colors for Selected (CellItemSelectedBackgroundBrush) and Hover (CellRowHoverBackgroundBrush)

     

    Please let me know if this helps you or you have further questions on this matter.

     

    Looking forward for your reply.

    XamGridColors.zip
Reply Children