Drop won't be called in RadDocking

2 posts, 0 answers
  1. Li
    Li avatar
    1 posts
    Member since:
    Jan 2014

    Posted 25 Jan 2014 Link to this post

    hi~
    The issue can be showed in the code below
    I have two TextBlocks, the only difference between them is where they are.
    but the one inside the RadPane never fires a Drop Event.

    xaml:
    <Window x:Class="test.MainWindow"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                    Title="MainWindow" Height="350" Width="525">
            <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock Name="src" Text="src" Grid.Column="0" PreviewMouseDown="src_PreviewMouseDown"></TextBlock>
            <telerik:RadDocking Grid.Column="1">
                <telerik:RadSplitContainer HorizontalAlignment="Stretch">
                <telerik:RadPaneGroup>
                    <telerik:RadPane>
                        <Grid>
                            <TextBlock AllowDrop="True" Background="LightYellow" Text="dst1" Drop="TextBlock_Drop"/>
                        </Grid>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
            <TextBlock AllowDrop="True" Background="LightBlue" Text="dst2" Drop="TextBlock_Drop" Grid.Column="2"/>
        </Grid>
    </Window>

    code behind:
    //using blahblah...
    namespace test
    {
        public partial class MainWindow : Window
        {
            public MainWindow() {
                InitializeComponent();
            }
            private void TextBlock_Drop(object sender, DragEventArgs e) {
                (sender as TextBlock).Text = "On drop";
            }
            private void src_PreviewMouseDown(object sender, MouseButtonEventArgs e){
                string k = (sender as TextBlock).Text;
                DragDropEffects allowedEffects = DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Link;
                DragDrop.DoDragDrop(sender as TextBlock, k, allowedEffects);
            }
        }
    }
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Jan 2014 Link to this post

    Hi Li,

    Instead of using default drop event, you have to use DragDropManager's Drop event and add a handler for it. You can read more information about DragDropManager in our online help.
    I've prepared a sample project based on your code and I've added a drop handler that is executed correctly. You can find it attached and give it a try.

    Hope this helps.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top