14 Answers, 1 is accepted
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
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 >>
.ChildrenOfType<Thumb>() I returning null.
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
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 >>
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}
this.pgSpectrums.ChildrenOfType<PropertyGridColumnResizer>().Count() is 0 so that's the problem.
I've tried to reproduce the problem you report, but to no avail. I have attached my test project for a reference.
Yoan
Telerik
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 >>
Indeed, you are right about that. May I ask you to test your project with our latest binaries?
Regards,Yoan
Telerik
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 >>
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.
Yoan
Telerik
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 >>
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);
}
}
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
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 >>