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

radGridView_Grouping event not fired

9 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 19 Jul 2013, 03:17 AM
IHi,

I have a grouping action event (see below) that fires when as a user I drop a column into the grouping area.  I also get the action event when I close the group.  However, when I create the group descriptor pro-grammatically (see below) the action event does not fire but the group   displays properly.  When I close the  group pro-grammatically created group I get the action event but  the program crashes.  What am i missing?

        private void CreateGroup_Click(object sender, RoutedEventArgs e)
        {
            GroupDescriptor descriptor = new GroupDescriptor();
            descriptor.Member = "CategoryName";
            descriptor.SortDirection = ListSortDirection.Ascending;
            this.gridQueryResult.GroupDescriptors.Add(descriptor);
           
            descriptor = new GroupDescriptor();
            descriptor.Member = "ProductName";
            descriptor.SortDirection = ListSortDirection.Ascending;
            this.gridQueryResult.GroupDescriptors.Add(descriptor);           
        }

private void gridQueryResult_Grouping(object sender, GridViewGroupingEventArgs e)
        {
            Telerik.Windows.Controls.GridViewColumn column = ((ColumnGroupDescriptor)e.GroupDescriptor).Column;

            if (e.Action == GroupingEventAction.Place)
            {
                if (column != null)
                    column.IsVisible = false;
            }
            else if (e.Action == GroupingEventAction.Remove)
            {
                if (column != null)
                    column.IsVisible = true;
            }
        }

9 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 19 Jul 2013, 06:51 AM
Hello Richard,

Actually, that would be the expected behavior. Grouping/Grouped events will be fired only when performing the action on the UI, not when inserting a new group descriptor in the GroupDescriptors collection.
What is the exact behavior that you want to achieve and why do you need it fired on adding a group descriptor programmatically ?  

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 19 Jul 2013, 02:53 PM

Hi Maya,

I want to accomplish two things.

When the user closes the app I want to save the group descriptions so the next time the user runs the query I can reestablish the groupings.  When I reestablish the groupings I want the Group column set to visible is false. (I want to see the column in the group but not in the detail section.

If and when the User closes the Group thru the UI I want to set the column back to visible. I am getting this event but it crashes in my event logic (see from previous post). Why does this crash happen.  There must be something else I need to setup.  When creating the Group from the UI there must be something done that I an not doing when I create the group from the program.

It my program did not crash in the event logic everything would be ok.

Thanks

Rich

0
Maya
Telerik team
answered on 22 Jul 2013, 07:33 AM
Hi Richard,

Saving the state of the grid can be performed with the help of RadPersistenceFramework. Check out our demos for more information. Considering the second issue, why not setting ShowColumnWhenGrouped property of the column to "false" ?  

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 22 Jul 2013, 03:04 PM

Hi Maya,

The demo asked me to install Silverlight and then didn't like my version of Internet explorer.  I am using Windows 8.1 and I guess its IE is not able to handle Silverlight.    I could turn of some security functions but I rather not if possible. Is there any other way to run the demo.

Thanks

Rich

0
Maya
Telerik team
answered on 22 Jul 2013, 03:29 PM
Hello Richard,

You can work with your own local copy of our demos. WPF demos can be installed from here as well. Let me know in case you find any issues with running the examples. 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 22 Jul 2013, 10:42 PM

Hi Maya

I am using wpf RadGridView and do not seem to have the ShowColumnWhenGrouped property.  Is that a Silverlight only thing.

Rich

0
Richard Harrigan
Top achievements
Rank 1
answered on 22 Jul 2013, 11:40 PM

Hi Maya

I referred to the Demo for WPF Persistence Manager Gridview and found that I could not compile the following:

private void OnSave(object sender, System.Windows.RoutedEventArgs e)

{

            PersistenceManager manager = new PersistenceManager();

            this.stream = manager.Save(this.gridView);



}

In order to get  PersistenceManager recognized I had to add  Using OpenAccessRuntime. 

new PersistenceManager()  failed because its an abstact class

manager.Save..........    Save not in PersistenceManager

Thanks

Rich

0
Maya
Telerik team
answered on 23 Jul 2013, 06:40 AM
Hi Richard,

ShowColumnWhenGrouped is a property of the column, not the grid. You can take a look at our documentation for more information.
Considering the second question, you do not need OpenAccessRuntime using. The required usings are listed in the example mentioned above and there are:

using Telerik.Windows.Persistence;
using Telerik.Windows.Persistence.Services;
using Telerik.Windows.Controls;

Do you still have compilation errors when you add those ? 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Harrigan
Top achievements
Rank 1
answered on 23 Jul 2013, 05:18 PM

Hi Maya,

I am using the those using statements.  What I did not have was a reference to Telerik.Persistence.Manager.  Since I did not get an error with the Persistence using statements I thought I did not need to reference an assembly.  I have a reference to the OpenAccess assembly and maybe that's why my using statements did not have an error or maybe I just don't understand how this all works. 

Thanks

Rich

Tags
GridView
Asked by
Richard Harrigan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Richard Harrigan
Top achievements
Rank 1
Share this question
or