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

Bind values to GridViewColumnGroup HeaderTemplate programmatically

4 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vinay
Top achievements
Rank 1
Vinay asked on 12 Jun 2012, 06:17 AM
Hi,
How can i bind values to GridViewColumnGroup HeaderTemplate pro grammatically.

<DataTemplate x:Key="GroupeHeaderScoresTemplate">
            <StackPanel DataContext="{Binding AssignmentHeaders}">
                <TextBox Text="{Binding AssignmentShortName}" Height="25" TextWrapping="Wrap"/>
                <TextBox Text="{Binding AssignmentDescription}" Height="25" TextWrapping="Wrap"/>
                <TextBox Text="{Binding AssignmentMarkingPeriod}" Height="25" TextWrapping="Wrap"/>
                <TextBox Text="{Binding AssignmentCategory}" Height="25" TextWrapping="Wrap"/>
                <telerik:RadDatePicker SelectedDate="{Binding AssignmentDate}" Height="25"></telerik:RadDatePicker>
                <TextBox Text="{Binding AssignmentWeight}" Height="25" TextWrapping="Wrap"/>
                <TextBox Text="{Binding AssignmentPossiblePoints}" Height="25" TextWrapping="Wrap"/>                               
            </StackPanel>
        </DataTemplate>

I have datatemplate as above and i am adding the template programitically,
var gridViewColumnScoreGroup = new GridViewColumnGroup { Name = "ColumnScoresGroup" + i, HeaderTemplate = CreateTemplate(i) };
            GridGradeView.ColumnGroups.Add(gridViewColumnScoreGroup);

Now how can i bind values to DataTemplate???


4 Answers, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 07 Nov 2012, 04:00 PM
I'm trying to do something similar for the WPF RadTreeListView - did you get any solution for this?
0
Pavel Pavlov
Telerik team
answered on 08 Nov 2012, 09:23 AM
Hi Gary ,

Please give some details on what exactly you are trying to achieve with column group headers.

All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Gary
Top achievements
Rank 1
answered on 08 Nov 2012, 11:24 AM
Hi Pavel,

We're trying to have collapsible and expandable headers, similar to the PivotGrid - I've got this working, apart from the column header '+' and '-' switching depending on whether the column group is expanded or collapsed.

I wanted to set a view model on the header so the template can simply bind through.

We're evaluating whether the Telerik control can let us do the column group expand and collapse - I've got the expand/collapsing working, but we have additional questions. If you see the attached screenshot, we needed to insert the "Colour Total" column group above the "Column" group to match the dimensionality of the Region column groups. We'd prefer the Colour column to span the two header rows.

Also, you can click and drag column headers to reorder columns, but not column group headers - is there a way to do this?

Do you have an email address I could maybe send our prototype project to, or if you'd like us to discuss our more-specific requirements?

Thanks,

Gary
0
Pavel Pavlov
Telerik team
answered on 08 Nov 2012, 01:17 PM
Hi Gary,

To be able to attach a project you will just need to open a support ticket form your account .
Please mention the ID of this thread (553508) so we can continue
the thread there.

All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Vinay
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or