Drag and Drop PropertyDefinition

8 posts, 0 answers
  1. Joël
    Joël avatar
    32 posts
    Member since:
    Sep 2011

    Posted 27 Sep 2011 Link to this post

    How to make Drag-n-Drop of PropertyDefinition towards RadRichTextBox, for example ?

    or

    How to find PropertyDefinition under the mouse ?
  2. Joël
    Joël avatar
    32 posts
    Member since:
    Sep 2011

    Posted 28 Sep 2011 Link to this post

    Could somebody help me? I need really this function quickly. Thanks.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 29 Sep 2011 Link to this post

    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 >>
  5. Joël
    Joël avatar
    32 posts
    Member since:
    Sep 2011

    Posted 29 Sep 2011 Link to this post

    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
  6. Joël
    Joël avatar
    32 posts
    Member since:
    Sep 2011

    Posted 29 Sep 2011 Link to this post

    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.
  7. Joël
    Joël avatar
    32 posts
    Member since:
    Sep 2011

    Posted 29 Sep 2011 Link to this post

    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;
  8. De
    De avatar
    16 posts
    Member since:
    Aug 2011

    Posted 05 Jun 2014 Link to this post

    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().
  9. Nick
    Admin
    Nick avatar
    593 posts

    Posted 06 Jun 2014 Link to this post

    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.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready