Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
800
drag and drop from DataSelector
posted

Hi,

I'd like to ask if it is possible to drag measures/dimensions from the dataselector and drop it to some other controls in my application? Maybe I'm doing something wrong but I can't drop anything dragged from the dataselector even if I set the allowdrop of the target and handle the drop event.

Thanks and best regards,
Tamas

  • 8831
    Verified Answer
    posted

    Hello Tamas,

    At this moment drag-drop is encapsulated into control only. It’s possible to extend its drag-drop but you have to re-template some of the parts of both XamPivotGrid and XamPivotDataSelector. I’m going to attach here these two files:

    1.       App.xaml – contains the re-templated XamPivotDataSelector with additional DropTriggerActionEx instances attached.

    2.       DropTriggerActionEx.cs – contains the implementation of custom drop handler.

     

    And here is how you’ll use it in your application:

    Apply to selector the style from App.xaml:

     

    <PivotGrid:XamPivotDataSelector Grid.Column="1"

    x:Name="dataSelector"

    DataSource="{StaticResource flatDataSource}"

    Style="{StaticResource XamPivotDataSelectorStyle}"/>

     

    Set some element as drop target. Note that when drop event handler is invoked drop target is checked by its name.

    <StackPanel Name="externalDropTarget"

                Background="LightBlue" Height="40">

        <ig:DragDropManager.DropTarget>

            <ig:DropTarget IsDropTarget="True"

                           DropChannels="Rows, Columns, Filters, MeasureList, Measures"

                           DropTargetMarkerBrush="Gold"/>

        </ig:DragDropManager.DropTarget>

    </StackPanel>

     

    Also note that this will work only for drag-drop initiated from the data selector. In order to make this possible from pivot grid you have to re-template it as well and attach the additional DropTriggerActionEx to its elements in similar way as I’ve done for the data selector.

     

    Regards.

    Plamen.

    DropTriggerActionEx.zip