Home Forums WPF controls Xceed DataGrid for WPF Alternate Colors

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22807 |

    Hi,

    how can i apply alternate colors to the gridcontrol.

    Imported from legacy forums. Posted by rajendernag (had 8526 views)

    Xceed Support
    Member
    Post count: 5658

    Can you be a little more specific on what color you want to change?

    Imported from legacy forums. Posted by Marcus [Xceed] (had 5146 views)

    User (Old forums)
    Member
    Post count: 23064

    I think the question refers to the ability to specify an Alternate Row color, similar to the .NET 2.0 DataGridView control. That control allows an Alternate Row color to be set, as well as a default row color. The row background color then alternates with each row.

    In other words, Row 0 has a white background, Row 1 has a gray background, Row 2 has a white background, Row 3 has a gray background, etc…

    I know that you can set cell styles, but I also have the same question as the orginal post — can the alternating row colors be set without a lot of code to dynamically determine whether the row is odd or even?

    Imported from legacy forums. Posted by Todd (had 1108 views)

    Xceed Support
    Member
    Post count: 5658

    We implemented something in version 1.1 to easily allow alternating “stuff” through triggers.

    Version 1.1 will be soon available… (beginning of May)

    Other than the trigger code, all that will be needed is a converter that convert an index into whatever value you want to trig on (allowing complex patterns).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 3729 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

     Please let us know if this feature has been released now. This is a critical functionality for us to finalize the xceed grid evaluation.

    Regards,

    Raja S L N

    Imported from legacy forums. Posted by Raja (had 1024 views)

    Xceed Support
    Member
    Post count: 5658

    The “Alternating DataRow Styles” in the Styling Elements topic demonstrates how to do this.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 2630 views)

    User (Old forums)
    Member
    Post count: 23064

    Hmm interesting.

    If you wanted to let the user turn this on and off with perhaps a checkbox.  How would you go about this?  Also if you wanted to let the user select the colors would you have to do it all programmatically?

     

     

    Imported from legacy forums. Posted by Dave (had 455 views)

    Xceed Support
    Member
    Post count: 5658

    While I am not sure there are nice 100% code-less approaches to scenarios such as the one you described, there are ways to preserve a nice separation between look and feature.

    The DataRow implicit style defined can use DataTriggers that are bound to properties defined on the Page/Window/UserControl ( RelativeSource FindAncestor ). These properties could enable/disable the alternate row coloring as well as configure its color. In this case, the Enabling property as well as the Coloring properties could be considered as features of the Page/Window/UserControl while the way to select them, display them and affect them on the DataGrid remain on the look side of things ( XAML-only ).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 877 views)

    User (Old forums)
    Member
    Post count: 23064

    How can i apply alternate colors on runtime?

     

    I want to give provision of a toggle button on check state i want to give alternate color (say Green) on unchecked state i want to remove thealternate color…

     I want to do this in my Code behind..

    Imported from legacy forums. Posted by arya009 (had 5077 views)

    Xceed Support
    Member
    Post count: 5658

    You can bind the IsAlternatingRowStyleEnabled property of the TableView class to the IsChecked property of the check box that will enable or disable the alternating styles.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 5075 views)

    User (Old forums)
    Member
    Post count: 23064

    Do u have any sample code for the alternate colors for using it on a gridcontrol?

     GridControl1….. > no property IsAlternatingRowStyleEnabled

    Imported from legacy forums. Posted by Insider (had 834 views)

    Xceed Support
    Member
    Post count: 5658

    The IsAlternatingRowStyleEnabled property is defined on the TableView class and not on the DataGridControl class.

    TableView view = new TableView();

    view.IsAlternatingRowStyleEnabled = true;

    dataGridControl1.View = view; 

    Imported from legacy forums. Posted by Jenny [Xceed] (had 5295 views)

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.