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

Drag from a RadSplitContainer to Another RadSplitContainer not working

1 Answer 72 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Matteo Gugliotta
Top achievements
Rank 1
Matteo Gugliotta asked on 29 Jun 2012, 01:28 PM
Hi,

i have an  user View composed by a raddocking object composed by 3 radsplicontainer.
The first RadSplitContainer (filterSplit) contains some  object that represent predefined query contained in a RadTreeView.

I want the user able  to drag from the tree view on left side (radTreeView ) 
to radsplicontainer on right side, bottom, in the list box. (listBox)

See the code below.

<telerik:RadDocking x:Name="radDocking" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HasDocumentHost="False"
                                 telerik:StyleManager.Theme="{StaticResource AgilentTheme}" Grid.Row="0" Grid.Column="0">
                <telerik:RadSplitContainer x:Name="filterSplit" InitialPosition="DockedLeft" Background="Transparent">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane x:Name="paneFilter"  Title="Filters"  telerik:StyleManager.Theme="{StaticResource AgilentTheme}"
                                         CanUserClose="False" CanFloat="False" ContextMenuTemplate="{x:Null}"  >
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                             
                                <telerik:RadTreeView x:Name="radTreeView" Margin="5" Grid.Row="0" IsDragDropEnabled="True"
                                     Background="White" BorderThickness="1" BorderBrush="LightGray" Padding="16">
                                    <telerik:RadTreeView.ItemContainerStyle>
                                        <Style TargetType="telerik:RadTreeViewItem">
                                            <Setter Property="IsExpanded" Value="True" />
                                        </Style>
                                    </telerik:RadTreeView.ItemContainerStyle>
                                    <telerik:RadTreeView.Items>
                                        <telerik:RadTreeViewItem Header="Hardcopy Mailing"/>
                                        <telerik:RadTreeViewItem Header="Telemarketing"/>
                                        <telerik:RadTreeViewItem Header="Marketing epush"/>
                                        <telerik:RadTreeViewItem Header="Attack Day"/>
                                    </telerik:RadTreeView.Items>
                                </telerik:RadTreeView>
                                <telerik:RadTreeView x:Name="radFilter" Margin="5" Grid.Row="1"
                                    IsDragDropEnabled="True" Background="White" BorderThickness="1" BorderBrush="LightGray" Padding="16">
                                    <telerik:RadTreeView.ItemContainerStyle>
                                        <Style TargetType="telerik:RadTreeViewItem">
                                            <Setter Property="IsExpanded" Value="True" />
                                        </Style>
                                    </telerik:RadTreeView.ItemContainerStyle>
                                    <telerik:RadTreeView.Items>
                                        <telerik:RadTreeViewItem Header="Account">
                                            <telerik:RadTreeViewItem Header="Information"/>
                                            <telerik:RadTreeViewItem Header="Marketing Attribute"/>
                                            <telerik:RadTreeViewItem Header="Sales Rep"/>
                                        </telerik:RadTreeViewItem>
                                        <telerik:RadTreeViewItem Header="Contact">
                                            <telerik:RadTreeViewItem Header="Information"/>
                                            <telerik:RadTreeViewItem Header="Marketing Attribute"/>
                                            <telerik:RadTreeViewItem Header="Marketing Attribute"/>
                                        </telerik:RadTreeViewItem>
                                        <telerik:RadTreeViewItem Header="Lead">
                                            <telerik:RadTreeViewItem Header="With Campaign Code"/>
                                            <telerik:RadTreeViewItem Header="Without Campaign Code"/>                                           
                                        </telerik:RadTreeViewItem>
                                        <telerik:RadTreeViewItem Header="Opportunity">
                                            <telerik:RadTreeViewItem Header="With Campaign Code"/>
                                            <telerik:RadTreeViewItem Header="Without Campaign Code"/>
                                        </telerik:RadTreeViewItem>
                                    </telerik:RadTreeView.Items>
                                </telerik:RadTreeView>
                            </Grid>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
                <telerik:RadSplitContainer x:Name="gridSplit" InitialPosition="DockedTop" Background="Transparent" >
                    <telerik:RadPaneGroup >
                        <telerik:RadPane x:Name="paneGrid"  Title="Data Sets"  telerik:StyleManager.Theme="{StaticResource AgilentTheme}"
                                CanUserClose="False" CanUserPin="False" CanFloat="False" ContextMenuTemplate="{x:Null}"
                                DataContext="{Binding ViewPropObject, ElementName=clauses}">
 
                            <ListBox x:Name="listBox" Margin="10" >                              
                                <ListBox.Style>
                                    <Style TargetType="ListBox">
                                        <Setter Property="telerik:RadDragAndDropManager.AllowDrop" Value="True" />
                                    </Style>
                                </ListBox.Style>
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="Control">
                                        <Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
                                        <Setter Property="telerik:RadDragAndDropManager.AllowDrop" Value="True" />
                                    </Style>
                                </ListBox.ItemContainerStyle>
                            </ListBox>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
                <telerik:RadSplitContainer x:Name="clausesSplit" InitialPosition="DockedBottom" Background="Transparent" >
                    <telerik:RadPaneGroup >
                        <telerik:RadPane x:Name="paneDataForm" telerik:StyleManager.Theme="{StaticResource AgilentTheme}"
                                         Title="Selected" CanUserClose="False" CanUserPin="False" CanFloat="False" ContextMenuTemplate="{x:Null}">
                             
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>

When i try to drag to the second splitcontainer it appears the non allowed icon.

Is it possible to do drag and drop between 2 different RadSplitContainer?


Best regards

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 03 Jul 2012, 06:45 AM
Hi Matteo,

You have set the allow drop property on the ListBox items, rather than the list box itself, is there a specific reason to do so? Note that this way you will only be able to drag to the list box only if it has at least one item in it, and you will be able to drop only on that item, not the list box. 

Could you try setting the allow drop property to true on the List box itself?  

Greetings,
Nik
the Telerik team

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

Tags
DragAndDrop
Asked by
Matteo Gugliotta
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or