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

How to detect when the first column is resized.

14 Answers 94 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 25 Jul 2013, 02:11 PM
I need to know how to detect when the label column of a property grid is resized.

14 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 26 Jul 2013, 09:01 AM
Hi Alex,

You can try to use ChildrenOfType<>() extension method and find the underlying element. In your case it will be the PropertyGridColumnResizer. Please check the following code snippet for a reference:

var cr = this.propertyGrid.ChildrenOfType<PropertyGridColumnResizer>().FirstOrDefault().ChildrenOfType<Thumb>().FirstOrDefault();
  
cr.DragDelta += new DragDeltaEventHandler(cr_DragDelta);   
 
void cr_DragDelta(object sender, DragDeltaEventArgs e)
{
    
}

Regards,
Yoan
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
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 02:04 PM

.ChildrenOfType<Thumb>() I returning null.

0
Yoan
Telerik team
answered on 26 Jul 2013, 02:13 PM
Hi Alex,

Can you please try to add the above code in RadPropertyGrid's Loaded event:

private void propertyGrid_Loaded(object sender, RoutedEventArgs e)
      {
          var cr = this.propertyGrid.ChildrenOfType<PropertyGridColumnResizer>().FirstOrDefault().ChildrenOfType<Thumb>().FirstOrDefault();
          cr.DragDelta += new DragDeltaEventHandler(cr_DragDelta);          
      }

Please let me know about the result.


Regards,
Yoan
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
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 02:23 PM
Still returning null. 

this.pgSpectrums.ChildrenOfType<PropertyGridColumnResizer>().FirstOrDefault().ChildrenOfType<Thumb>().Count()

is returning 

 'this.pgSpectrums.ChildrenOfType<PropertyGridColumnResizer>().FirstOrDefault().ChildrenOfType<Thumb>().Count()' threw an exception of type 'System.ArgumentNullException' int {System.ArgumentNullException}
0
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 02:38 PM
actually

this.pgSpectrums.ChildrenOfType<PropertyGridColumnResizer>().Count() is 0 so that's the problem.
0
Yoan
Telerik team
answered on 26 Jul 2013, 02:58 PM
Hi Alex,

I've tried to reproduce the problem you report, but to no avail. I have attached my test project for a reference.

Regards,
Yoan
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
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 03:05 PM
I'm using version 2013.1.403.40 your using 2013.2.611.40, could that be the problem?
0
Yoan
Telerik team
answered on 26 Jul 2013, 03:19 PM
Hello Alex,

Indeed, you are right about that. May I ask you to test your project with our latest binaries?

Regards,
Yoan
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
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 03:20 PM
I don't have access to that apparently.  I can only download the one I have.
0
Yoan
Telerik team
answered on 26 Jul 2013, 03:33 PM
Hi Alex,

Actually, you can download our latest binaries from your account :

Products & Subscriptions -> Trial downloads -> RadControls for WPF -> Download -> download a file.

I hope this helps.

Regards,
Yoan
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
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 03:53 PM
I still get the same error.
0
Alex
Top achievements
Rank 1
answered on 26 Jul 2013, 05:03 PM
Figured out the problem, it was calling the load even if it is not shown (which it wasn't').  Fixed that.  Still doesn't do what I want.  Even your example didn't call the function when I changed the width of the label column.
0
Alex
Top achievements
Rank 1
answered on 29 Jul 2013, 03:40 PM

This code isn't working either.  I thought maybe I wasn't using the correct thumb and it's not working

foreach (PropertyGridColumnResizer clsProperty in this.pgSpectrums.ChildrenOfType<PropertyGridColumnResizer>())
                {
                    foreach (Thumb clsThumb in clsProperty.ChildrenOfType<Thumb>())
                    {
                        clsThumb.DragDelta += new DragDeltaEventHandler(cr_DragDelta); 
                    }
                }
0
Yoan
Telerik team
answered on 31 Jul 2013, 03:15 PM
Hi Alex,

You can try to subscribe to RadPropertyGrid's FieldLoaded event like so:

private void propertyGrid_FieldLoaded(object sender, FieldEventArgs e)
        {
            Dispatcher.BeginInvoke((Action)(() =>
            {
                var cr = e.Field.ChildrenOfType<PropertyGridColumnResizer>().FirstOrDefault().ChildrenOfType<Thumb>().FirstOrDefault();
                
         cr.DragDelta += new DragDeltaEventHandler(cr_DragDelta);
                
            }));           
        }
 
        void cr_DragDelta(object sender, DragDeltaEventArgs e)
        {
 
        }

Please let me know how it goes.


Regards,
Yoan
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 >>
Tags
PropertyGrid
Asked by
Alex
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Alex
Top achievements
Rank 1
Share this question
or