GridViewDataColumn GroupMemberPath + GroupHeaderTemplate/GroupHeaderFormatString

8 posts, 0 answers
  1. Heiko Görig
    Heiko Görig avatar
    23 posts
    Member since:
    Jun 2012

    Posted 05 May 2010 Link to this post

    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
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 May 2010 Link to this post

    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.
  3. DevCraft banner
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 May 2010 Link to this post

    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.
  5. Heiko Görig
    Heiko Görig avatar
    23 posts
    Member since:
    Jun 2012

    Posted 11 May 2010 Link to this post

    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

     

  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 May 2010 Link to this post

    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.
  7. Heiko Görig
    Heiko Görig avatar
    23 posts
    Member since:
    Jun 2012

    Posted 11 May 2010 Link to this post

    I haven't changed the binding in your example. It's still

    <

     

     

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

     

  8. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 May 2010 Link to this post

    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.
  9. Heiko Görig
    Heiko Görig avatar
    23 posts
    Member since:
    Jun 2012

    Posted 11 May 2010 Link to this post

    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.
Back to Top
DevCraft banner