This is a migrated thread and some comments may be shown as answers.

GridView footer vertical alignment problem

1 Answer 21 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 02 Dec 2011, 05:52 PM
Hi,

We are using the GridView and are adding in the use of column footers and, because of the way our site is implemented, we are creating the footers completely in code behind.

We are creating a new Grid object and setting the column.Footer as this new Grid object.

Using the example screenshot attached, you'll see that 2 of the column footers have grids with 3 rows in and another column has a grid with only 2 rows in.  We want the grid in the column footer with only 2 rows in to appear at the top (vertically aligned) but it keeps appearing vertically centered within the footer cell.  We've tried setting the Grid.VerticalAlignment = Top but it has no effect.  Each grid in the footer has a maximum of 4 rows (sum/min/max/average) but we don't know until runtime how many there will be.

Is there a property on the column that I've missed to set this vertical alignment?

Thanks

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 07 Dec 2011, 04:16 PM
Hi Chris,

This is actually more of a general XAML layout problem, rather than Teleriks.
There are various options that you can choose to accomplish this. You can redefine the DataTamplate of the footer cell to contain a StackPanel and use its functionality to arrange the content. This is not a bad solution however you are probably going to have to set some margins, paddings etc.

Another approach that you can use, and I would actually suggest it as a better one, is to redefine the DataTemplate to contain a Grid with the necessary count of RowDefinitions with Height="Auto". That way you will accomplish the desired layout easily and without much effort.
You can check some MSDN articles about details on how to implement it.

Hope this was helpful!

Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or