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

AllowDrop not working as expected?

3 Answers 486 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Wetzorke
Top achievements
Rank 1
Wetzorke asked on 18 Oct 2017, 10:12 AM

Hello,

in our project, we have multiple RadPanes in a RadDocking control.
One of those RadPanes should not be draggable and the user is not allowed to drop other panes on this one.
Setting the IsDragDisabled property to true doesn't seem to change the behaviour, only in combination with PaneHeaderVisibility = Visibility.Collapsed.
But setting CanFloat to true results in the desired behaviour.

However, I cannot get the second part (about not allowing to drop other panes on this one) working.
I tried using the AllowDrop property, but setting it to true or false doesn't seem to make any difference.
Is there anything else to consider when using the AllowDrop property?

As a workaround, I tried using the PreviewDrop event of the docking control and the RadPaneGroup but neither seem to fire when a RadPane is dropped. I only get the PaneStateChanged event but as far as I know, this one does not contain any information on the drop target.

Any help would be appreciated.

Best regards.

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 23 Oct 2017, 10:02 AM
Hello Bernd,

I will check your case and get back to you with more information on the matter.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Accepted
Martin Ivanov
Telerik team
answered on 23 Oct 2017, 11:44 AM
Hello Bernd,

To achieve your requirement and disallow drop on specific position you can use the PreviewShowCompass event of RadDocking. Basically, if the pane under the mouse forbids drop you can set the event arguments' Canceled property to True. You can find this approach shown in the attached project. I hope it helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Wetzorke
Top achievements
Rank 1
answered on 25 Oct 2017, 02:44 PM

Hello Martin,

 

thanks for your reply and the attached project. That was very helpful.

I altered your approach with the PreviewShowCompass event slightly, so that I don't need to include the MouseUtilities class.

Here is what I changed as it might be helpful to someone else

private void Docking_PreviewShowCompass(object sender, Telerik.Windows.Controls.Docking.PreviewShowCompassEventArgs e)
{
    if (e.TargetGroup != null && e.TargetGroup == paneGroup)
    {
        e.Canceled = true;
    }
}

 

Thanks again and best regards.

Tags
Docking
Asked by
Wetzorke
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Wetzorke
Top achievements
Rank 1
Share this question
or