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
360
Drag Drop items between dynamic list boxes
posted

Hi Team,

Is there a possiblity to drag and drop items between dynamic list boxes which has dynamic items in them in infragistics drag and drop framework.

I tried the same using WPF drag and drop framework all is working good except the scroll as mentioned below.

Does infragistics drag and drop framework can be implemented for this scenario .Can you please provide a sample if thats the case.

Thanks a lot for your support in advance.

Xaml Code:

<StackPanel>
<ItemsControl x:Name="ReferencesNew" >
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer x:Name="ScrollViewer1" PreviewDragOver="ScrollViewer_OnPreviewDragOver" PreviewDragLeave="ScrollViewer_OnPreviewDragLeave" Margin="0,0,0,0" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>


<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" CanHorizontallyScroll="True" dragAndDropBehaviors:ScrollOnDragOverBehavior.IsScrollOnDragOverEnabled="True" Margin="0,0,0,0"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate >
<DataTemplate>
<ListView ScrollViewer.PanningMode="None" ItemsSource="{Binding Reports}" Margin="0,0,5,0" MinHeight="100" MinWidth="150" BorderThickness="1,1,1,1" Drop="ListBox_Drop" AllowDrop="True" PreviewMouseLeftButtonDown="ListBox_PreviewMouseLeftButtonDown"
SelectionMode="Single" MaxHeight="170">
<ListView.ItemTemplate>
<DataTemplate>
<Grid MouseMove="UIElement_OnMouseMove">
<DockPanel>
<TextBlock Text="{Binding ReportName}" DockPanel.Dock="Left" dragAndDropBehaviors:ScrollOnDragOverBehavior.IsScrollOnDragOverEnabled="True" />


</DockPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>

<StackPanel>
<ItemsControl x:Name="ReferencesNew" >
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer x:Name="ScrollViewer1" PreviewDragOver="ScrollViewer_OnPreviewDragOver" PreviewDragLeave="ScrollViewer_OnPreviewDragLeave" Margin="0,0,0,0" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>


<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" CanHorizontallyScroll="True" dragAndDropBehaviors:ScrollOnDragOverBehavior.IsScrollOnDragOverEnabled="True" Margin="0,0,0,0"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate >
<DataTemplate>
<ListView ScrollViewer.PanningMode="None" ItemsSource="{Binding Reports}" Margin="0,0,5,0" MinHeight="100" MinWidth="150" BorderThickness="1,1,1,1" Drop="ListBox_Drop" AllowDrop="True" PreviewMouseLeftButtonDown="ListBox_PreviewMouseLeftButtonDown"
SelectionMode="Single" MaxHeight="170">
<ListView.ItemTemplate>
<DataTemplate>
<Grid MouseMove="UIElement_OnMouseMove">
<DockPanel>
<TextBlock Text="{Binding ReportName}" DockPanel.Dock="Left" dragAndDropBehaviors:ScrollOnDragOverBehavior.IsScrollOnDragOverEnabled="True" />


</DockPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>

Regards,

Sridhar

Parents
No Data
Reply
  • 17475
    Offline posted

    Hello Srikanth,

    I am not sure what is the scrolling issue that you have mentioned. Can you please be more specific?

    There are event handlers and I am not sure how you are using those in the code-behind. Do you apply some custom logic there?

    I am sharing a sample project with two views containing ListBoxes and the user can drag and drop the items from one ListBox to the other. The sample project can be used as a reference when implementing the drag and drop functionality.

    Feel free to let me know if you have any questions or concerns.

    DragDropToDifferentViews.zip
Children
No Data