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

GridViewDataColumn GroupMemberPath + GroupHeaderTemplate/GroupHeaderFormatString

7 Answers 294 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Heiko Görig
Top achievements
Rank 1
Heiko Görig asked on 05 May 2010, 08:27 AM
Hi,

I have a GridViewDataColumn which shows numeric values. If the user drags the column to the group panel, I want to group the column not by the values itself but by rounded values. So I've added a new Property "RoundedValue" to my business objects and changed the GroupMemberPath of the GridViewDataColumn accordingly. The grouping works perfectly but if I specify a GroupHeaderFormatString or a GroupHeaderTemplate for the column, neither of them gets applied to the group key (the rounded value). It seems that both GroupHeaderFormatString and GroupHeaderTemplate only work if no GroupMemberPath is defined or if the GroupMemberPath of the column matches the path in the DataMemberBinding. Is this behaviour intended or is it a bug? I think if I it is possible to specify a distinct GroupMemberPath, it should also be possible to control the formatting of this member.

Edit: I've noticed another bug: If I specify a GroupMemberPath on a column, then group by that column and after that group by another column, I can't expand the upper groups anymore.

Thank you in advance,
Heiko

7 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 11 May 2010, 11:11 AM
Hello Heiko Görig,

Thank you for reporting these issues! I have updated your Telerik points.

I have prepared a small project with a workaround for the first problem. Please find it attached .
To have the header displaying RoundedValue with a format string applied, you just need to set the format string to the RoundedValue column itself as demonstrated in the sample. 

I have tried to reproduce the second issue , but with no success so far . Can you please check if you can reproduce it with the project attached.

Regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Pavel Pavlov
Telerik team
answered on 11 May 2010, 11:26 AM
Hello Heiko Görig,

Thank you for reporting these issues! I have updated your Telerik points.

I have prepared a small project with a workaround for the first problem. Please find it attached .
To have the header displaying RoundedValue with a format string applied, you just need to set the format string to the RoundedValue column itself as demonstrated in the sample. 

I have tried to reproduce the second issue , but with no success so far . Can you please check if you can reproduce it with the project attached.

Regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Heiko Görig
Top achievements
Rank 1
answered on 11 May 2010, 12:07 PM
Thank you very much!

Concerning the second issue:
Actually I am rounding the value to a value range of type Tuple<double, double>. If you change the property RoundedValue to

public

 

 

Tuple<double, double> RoundedValue

 

 

{

 

 

 

    get

 

    {

        return new Tuple<double, double>(Math.Floor(Value), Math.Floor(Value) + 1);

    }

}

then group by Value (or RoundedValue) and afterwards group by Description, the described error occurs

 

0
Pavel Pavlov
Telerik team
answered on 11 May 2010, 01:58 PM
Hi Heiko Görig,

Thanks for the clarification ! Can you please paste me  how do you bind to the RoundedValue property  ( XAML ?)

Meanwhile I am going to log the error and schedule a fix.

Greetings,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Heiko Görig
Top achievements
Rank 1
answered on 11 May 2010, 02:03 PM
I haven't changed the binding in your example. It's still

<

 

 

telerik:GridViewDataColumn DataMemberBinding="{Binding RoundedValue}" DataFormatString="{}{0:N}" />

 

0
Pavel Pavlov
Telerik team
answered on 11 May 2010, 02:29 PM
Hello Heiko Görig,

Here is how to modify the XAML, in order to make it work as expected:

<telerik:RadGridView x:Name="RadGridView1" AutoGenerateColumns="False"
           <telerik:RadGridView.Columns
               <telerik:GridViewDataColumn DataMemberBinding="{Binding Value}"  GroupMemberPath="RoundedValue.Item1" /> 
               <telerik:GridViewDataColumn DataMemberBinding="{Binding RoundedValue.Item1}" DataFormatString="{}{0:N}" /> 
               <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" /> 
           </telerik:RadGridView.Columns>

I believe the grouping  fails as RadGridVIew does not know what to do with the Tuple.
Anyway the binding should be to the item of the Tuple, rather than to the Tuple itself.


Greetings,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Heiko Görig
Top achievements
Rank 1
answered on 11 May 2010, 03:08 PM
That doesn't help because I want the tuple to be the key of the group and not one value of the tuple so that I am able to display group headers like
10 $ - 20 $
20 $ - 50 $
50 $ - 100 $
and so on. Using your solution, I could create a group header template with a converter which would map the value of the tuple to the tuple itself, but that wouldn't be as nice as binding to the tuple directly.
Tags
GridView
Asked by
Heiko Görig
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Heiko Görig
Top achievements
Rank 1
Share this question
or