RadDragAndDropManager

3 posts, 0 answers
  1. Michael
    Michael avatar
    105 posts
    Member since:
    Nov 2010

    Posted 10 Sep 2011 Link to this post

    Since installing Q2 2011 drag & drop is no longer working in my app?

    Could there be a link between these 2 events??

    Should I move over to the new dragdrop??
  2. Michael
    Michael avatar
    105 posts
    Member since:
    Nov 2010

    Posted 11 Sep 2011 Link to this post

    here's the code. The list box has the following handlers added in code behind, the whole page has been working fine until I installed the Q2 update??

                RadDragAndDropManager.AddDragQueryHandler(memberList, onListBoxDragQuery);
                RadDragAndDropManager.AddDragInfoHandler(memberList, onListBoxDragInfo);
     

    <
    UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
                 x:Class="WAC_Races_WPF.View.RaceDay"
            xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
            mc:Ignorable="d" d:DesignHeight="240" d:DesignWidth="650">
     
    <Grid>
        <telerik:RadDocking
        BorderBrush="{x:Null}"
        BorderThickness="0"
        Padding="0">
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer
                Orientation="Horizontal">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                 
          
                               <telerik:RadGridView Grid.Row="1"
                                     x:Name="resultsView"
                                     ShowColumnFooters="True"                           
                                     IsFilteringAllowed="False"
                                     CanUserDeleteRows="True"
                                     CanUserReorderColumns="False"
                                     ShowGroupPanel="False"
                                     telerikDragDrop:RadDragAndDropManager.AllowDrop="True"
                                     ItemsSource="{Binding Path=CurrentRace.Results}"
                                     AutoGenerateColumns="False">
     
     
                                    <telerik:RadGridView.Columns>
     
                                            <telerik:GridViewDataColumn
                                                DataMemberBinding="{Binding MemberName}"
                                                Header="Member Name"
                                                IsReadOnly="True">
                                                <telerik:GridViewDataColumn.AggregateFunctions>
                                                    <telerik:CountFunction Caption="Members: "/>
                                                </telerik:GridViewDataColumn.AggregateFunctions>
                                            </telerik:GridViewDataColumn>
     
                                            <telerik:GridViewDataColumn
                                            DataMemberBinding="{Binding Cost}"
                                            Header="Charge"
                                            IsReadOnly="True" DataFormatString="{}{0:c}">
                                                <telerik:GridViewDataColumn.AggregateFunctions>
                                                    <telerik:SumFunction ResultFormatString="{}Total:{0:c}"/>
                                                </telerik:GridViewDataColumn.AggregateFunctions>
                                            </telerik:GridViewDataColumn>
     
                                                <telerik:GridViewDataColumn
                                            DataMemberBinding="{Binding Handicap, Mode=TwoWay}"
                                            Header="Handicap Grp"/>
     
                                        <telerik:GridViewMaskedTextBoxColumn
                                            DataMemberBinding="{Binding HandicapString}"
                                            Header="Start Time"
                                            MaskType="DateTime"
                                            Mask="mm-ss" />
     
                                            <telerik:GridViewMaskedTextBoxColumn
                                            DataMemberBinding="{Binding rTime}"
                                            Header="Stop Watch Time"
                                            IsVisible="{Binding ElementName=tbStopWatch, Path=IsChecked}"
                                            >
                                                <telerik:GridViewMaskedTextBoxColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <telerik:RadMaskedTextBox Value="{Binding rTime}"
                                                                                  MaskType="DateTime"
                                                                                  Mask="HH:mm:ss"/>
                                                    </DataTemplate>
                                                </telerik:GridViewMaskedTextBoxColumn.CellTemplate>
                                                <telerik:GridViewMaskedTextBoxColumn.CellEditTemplate>
                                                    <DataTemplate>
                                                        <telerik:RadMaskedTextBox Value="{Binding rTime, Mode=TwoWay}"                                                   
                                                       Mask="{Binding Path=HourMask}"
                                                       MaskType="DateTime"/>
                                                    </DataTemplate>
                                                </telerik:GridViewMaskedTextBoxColumn.CellEditTemplate>
                                            </telerik:GridViewMaskedTextBoxColumn>
     
                                        </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </Grid>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
     
                <telerik:RadSplitContainer
                    InitialPosition="DockedLeft">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane CanUserClose="False">
                            <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                        <Grid
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition/>
                                            </Grid.ColumnDefinitions>
                                            <Label Content="Search" FontWeight="Bold" Grid.Column="0"/>
                                            <TextBox x:Name="txtFilter" Grid.Column="1" 
                                                     Text="{Binding Path=FilterText, Mode=TwoWay}"
                                                        TextChanged="txtFilter_TextChanged"/>
                                        </Grid>
                                <ListBox Margin="10,10,10,10"
                                         Grid.Row="1"
                                         x:Name="memberList"
                                         ItemsSource="{Binding Path=FilterMembers}"
                                         VerticalAlignment="Stretch"
                                         HorizontalAlignment="Stretch"
                                         HorizontalContentAlignment="Stretch"
                                         telerikDragDrop:RadDragAndDropManager.AllowDrag="True"
                                         >
                 
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <Border BorderBrush="DarkGray" BorderThickness="1" Padding="2" Margin="1">
                                                    <Grid>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="15" />
                                                            <RowDefinition Height="14" />
                                                        </Grid.RowDefinitions>
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="90" />
                                                            <ColumnDefinition Width="Auto" />
                                                        </Grid.ColumnDefinitions>
     
                                                        <TextBlock Grid.ColumnSpan="2" Grid.Row="0" Text="{Binding Path=FullName}" FontWeight="Bold"/>
     
                                                        <TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding Path=MembershipString}" />
                                                        <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Path=mGrpID}" />
     
                                                    </Grid>
                                                </Border>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>           
                
                                        <ListBox.ItemContainerStyle>
                                            <Style TargetType="ListBoxItem">
                                                <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrag" Value="True" />
                                                <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
                                            </Style>
                                        </ListBox.ItemContainerStyle>
                                </ListBox>
                            </Grid>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
    </Grid>
    </UserControl>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 13 Sep 2011 Link to this post

    Hello Michael,

     Since Q2 we have introduced new API with improved support in many scenarios(http://www.telerik.com/help/wpf/dragdropmanager-overview.html). The events of the RadDragAndDropManager  are still executed, however the new drag mechanism is used.

    The problem you are facing is due to the fact that WPF listbox captures the mouse on mouseleftbutton down and thus suppress DragDropManager drag mechanism.

    There are several solutions to this issue:

     - Set drag execution mode to legacy - http://www.telerik.com/help/wpf/raddragdropmanager-howto-change-drag-execution-mode.html

     - Add DragDropManager.AllowCapturedDrag="true" in addition to RadDragAndDropManager.AllowDrag="true"

    Let us know if you have any further issues regarding this.

    Kind regards,
    Tsvyatko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top