Make GroupHeaderTemplate as wide as the grid

2 posts, 0 answers
  1. Dave Aronow
    Dave Aronow avatar
    7 posts
    Member since:
    Sep 2011

    Posted 23 Mar 2012 Link to this post

    I am using the GroupHeaderTemplate to display field-level information (grouping on a unique key for each row to force one group per item) but since I am doing this I need to find a way to get the group header to be as wide as the grid (so that the right-most control appears flush against the right edge of the grid).  

    I tried using StackPanels set to stretch but I can't get the header to be any wider than the controls contained in it (I assume this is by design which is usually what you want).   One hack I tried is putting an empty textblock before the control I need to be all the way to the right) which moves the control over but that then requires handling resizing events and recalculating the "filler" width and is a general nightmare. 

    Is there any other way I can do this?

    Thanks.
    Dave
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 27 Mar 2012 Link to this post

    Hi David, 

    Generally, you will need to edit the template of GridViewGroupRow and remove the elements reserved for the aggregates. Afterwards you can set HorizontalAlignment property of the StackPanel. 
    I am attaching a sample project illustrating the suggested approach.


    Regards,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top