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

[Solved] RadGridView Grouped Row Selected Event

5 Answers 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Balsuyambu
Top achievements
Rank 1
Balsuyambu asked on 24 Sep 2010, 08:42 AM
Hi Telerik Team,

I need to raise the event when user select the Group icon(expand/collapse). i have implemented the this feature from below mentiond article.

http://www.telerik.com/community/forums/silverlight/gridview/radgridview-grouped-row-selected-event.aspx

But if i try to get the status of expand/collapse from parentGroupRow.IsExpanded when i click the Group icon, It is giving the wrong value . if group row is expanded then it return as "false" and if its collapse, it return as "true".

Can you please verify this.

Thanks
Balsuyambu


5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 24 Sep 2010, 12:09 PM
Hello Balsuyambu,

I was not able to reproduce the issue you specified and the code-snippet provided in the forum thread executes as expected. Thus in order to provide you with any solution, I would need more details about your application and more specifically about the exact way you are defining the OnGridMouseDown method.
 

All the best,
Maya
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
Balsuyambu
Top achievements
Rank 1
answered on 24 Sep 2010, 12:25 PM
Hi Maya,

We have grid with group functionality and we need to raise the GroupedRowExpanded event to the user when expand/collapse the group. so i refer the article which i mentioned and did the implementation and mentioned below.

 

private void iGrid_GridMouseDown(object sender, MouseButtonEventArgs e)

 

{

 

if (this.IsGrouping)

 

{

 

    var objSender = e.OriginalSource as FrameworkElement;

 

 

    var gvrParent = objSender.ParentOfType<GridViewRow>();

 

 

    var gvgrparent = objSender.ParentOfType<GridViewGroupRow>();

 

 

    if (gvrParent == null && gvgrparent != null)

 

    {

 

        GridViewGroupRowExpandEventArgs args = new GridViewGroupRowExpandEventArgs()

 

        {

            Group = gvgrparent.Group,

            Expanded = gvgrparent.IsExpanded

        };

 

    if (GroupedRowExpanded != null)

 

        GroupedRowExpanded(

this, args);

 

    }

}

}

if user expand the group, i get the gvgrparent.IsExpanded property value as False and if user collapse the group then True is returned.

I think GridMouseDown is fired first and then gvgrparent.IsExpanded property value change to true if group expanded.

Thanks
Balsuyambu



0
Maya
Telerik team
answered on 24 Sep 2010, 01:03 PM
Hi Balsuyambu,

Basically, it is not recommended to use the GridViewGroupRowExpandEventArgs in such a way and raise any event like that. If you share more details about your scenario and requirements, I may be able to provide you with a more appropriate solution for your case.
 

Best wishes,
Maya
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
Balsuyambu
Top achievements
Rank 1
answered on 24 Sep 2010, 02:21 PM
Hi Maya,

Thanks for your suggestion.

We need to expose the event to the user on group expand and collape. This is our requirement.

Is there any way to achieve the functionality

Please clarify

Thanks
Balsuyambu S.
0
Maya
Telerik team
answered on 28 Sep 2010, 11:16 AM
Hello Balsuyambu,

It is more appropriate in your case to add custom events raised on expanding/collapsing group row. For example:

public event EventHandler GroupExpanded;
public event EventHandler GroupCollapsed;

private void OnGridMouseDown(object sender, MouseButtonEventArgs e)
{
    if (this.playersGrid.IsGrouping)
    {
        var senderElement = e.OriginalSource as FrameworkElement;
        var parentRow = senderElement.ParentOfType<GridViewRow>();
        var parentGroupRow = senderElement.ParentOfType<GridViewGroupRow>();
 
        if (parentRow == null && parentGroupRow != null)
        {
            if(parentGroupRow.IsExpanded = true && this.GroupExpanded != null)
            {
                this.GroupExpanded(this, EventArgs.Empty);
            }
                else if(parentGroupRow.IsExpanded == false && this.GroupCollapsed != null)
               {
                this.GroupCollapsed(this, EventArgs.Empty);
               }
        }
    }
}

Thus you can correctly implement the logic you need.
 

Best wishes,
Maya
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
Tags
GridView
Asked by
Balsuyambu
Top achievements
Rank 1
Answers by
Maya
Telerik team
Balsuyambu
Top achievements
Rank 1
Share this question
or