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

Drag and Drop PropertyDefinition

7 Answers 169 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Joël
Top achievements
Rank 2
Joël asked on 27 Sep 2011, 03:13 PM
How to make Drag-n-Drop of PropertyDefinition towards RadRichTextBox, for example ?

or

How to find PropertyDefinition under the mouse ?

7 Answers, 1 is accepted

Sort by
0
Joël
Top achievements
Rank 2
answered on 28 Sep 2011, 03:57 PM
Could somebody help me? I need really this function quickly. Thanks.
0
Ivan Ivanov
Telerik team
answered on 29 Sep 2011, 12:15 PM
Hello Laurent,

I have prepared an example project that illustrates a basic drag and drop scenario between a RadPropertyGrid and a ListBox. Would you please shed some more light on your requirements, especially on RadRichTextBox's role, in case that you have met any obstacles while adapting the approach from my project to your needs? I am attaching the example for your reference.

Best wishes,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Joël
Top achievements
Rank 2
answered on 29 Sep 2011, 01:21 PM
Thank you very much Ivan,

I
see the principle well now.

Unfortunately, I have just tested your application and this one does not function,

function
 
e.GetElement<PropertyGridField>(Mouse.GetPosition(this)) 

always
return null
0
Joël
Top achievements
Rank 2
answered on 29 Sep 2011, 01:36 PM
I have just remade some tests with your application, apparently, that functions but it takes PropertyGridField located at the top of that selected.

Therefore, that operation not if I Drag "Age", but if I Drag FirstName, it find Age

Moreover, that functions only if I am in full screen.
0
Joël
Top achievements
Rank 2
answered on 29 Sep 2011, 01:46 PM
I found the solution, it seems to me.

In
private void OnDragQuery(object sender, DragDropQueryEventArgs e) 

I
have replace

PropertyGridField field = e.GetElement<PropertyGridField>(Mouse.GetPosition(grille)); 

by


PropertyGridField field = e.Options.Source as PropertyGridField;
0
De
Top achievements
Rank 1
answered on 05 Jun 2014, 09:20 PM
With the new DragDropManager (instead of RadDragAndDropManager), how to get the PropertyGridField when mouse is dragging over it?
(The DragEventArgs is not the same as DragDropQueryEventArgs.  It doesn't have GetElement().
0
Nick
Telerik team
answered on 06 Jun 2014, 07:41 AM
Hello,

You can use the e.OriginalSource property in combination with the ParentOfType extension method to get the target PropertyGridField.
var field = e.OriginalSource as PropertyGridField ?? (e.OriginalSource as FrameworkElement).ParentOfType<PropertyGridField>();

Hope this helps. 


Regards,
Nik
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PropertyGrid
Asked by
Joël
Top achievements
Rank 2
Answers by
Joël
Top achievements
Rank 2
Ivan Ivanov
Telerik team
De
Top achievements
Rank 1
Nick
Telerik team
Share this question
or