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

The header of GridViewColumnGroup doesn't gets refreshed when set programatically.

2 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mausami
Top achievements
Rank 1
Mausami asked on 06 Aug 2012, 12:27 PM
Hi Telerik Team,

I have added a GridViewColumnGroup to a WPF RadGridView (version 2011.3.1220.40).

<Telerik:RadGridView.ColumnGroups>
       <Telerik:GridViewColumnGroup Name="gvGroup" Header="Header"></Telerik:GridViewColumnGroup>
</Telerik:RadGridView.ColumnGroups>


The header text is dynamic in my case. The gridview data gets refreshed on click of an hyperlinkcolumn of the same grid, so the header text of the GridViewColumnGroup also needs to refreshed. I tried changing the header text programmatically as given below.

The data in the gridview gets refreshed but the header text of the GridViewColumnGroup is not getting refreshed consistently. 
Sometimes it does gets refreshed where as sometimes it doesn't .

foreach (GridViewColumnGroup item in radgvPrerequisiteRelType.ColumnGroups)
{
           if (item.Name == "gvGroup")
            {
               item.Header = null;
               item.Header = "ProjectId [" + lngProjectId + "]";
            }
}

Could you please let me know the solution for this problem.



Thanks,
Regards,
Mausami

2 Answers, 1 is accepted

Sort by
0
Martin Hulvej Høgenhaug
Top achievements
Rank 1
answered on 08 Nov 2012, 08:57 PM
I have the same problem. Is there a solution to this problem, Telerik?
0
Pavel Pavlov
Telerik team
answered on 09 Nov 2012, 09:54 AM
Hi,

I would recommend the standard approach of binding rather than setting things programmatically in WPF.

You may expose a small view model as a static resource on the window / user control. The view model will contain the values that would change over time. You can then bind the text of a textblock in the header to a value of this view model.

Kind regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Mausami
Top achievements
Rank 1
Answers by
Martin Hulvej Høgenhaug
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or