Skip to content

Instantly share code, notes, and snippets.

@nimnes
Created November 12, 2014 07:27
Show Gist options
  • Save nimnes/d24e03248b00f9ac77c5 to your computer and use it in GitHub Desktop.
Save nimnes/d24e03248b00f9ac77c5 to your computer and use it in GitHub Desktop.
XAML to reproduce bug
<Window x:Class="DefaultsExample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:local="clr-namespace:DefaultsExample"
Title="Gong Solutions Drag'n'Drop: Defaults Example"
Height="500"
Width="800">
<Window.Resources>
<DataTemplate x:Key="DragAdorner">
<Border Background="Silver"
BorderBrush="Gray"
BorderThickness="1"
CornerRadius="2"
Margin="1">
<StackPanel Orientation="Horizontal">
<Image Source="/icon.png"
Width="16"
Margin="0,0,2,0"
VerticalAlignment="Center" />
<TextBlock Text="{Binding}"
Margin="0,0,2,0"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</DataTemplate>
<CollectionViewSource x:Key="GroupedCollectionViewSource"
Source="{Binding GroupedCollection}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Group" />
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>
<Window.DataContext>
<local:Data />
</Window.DataContext>
<StackPanel Orientation="Horizontal">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Grid.ColumnSpan="2"
Margin="0,8,0,8"
TextWrapping="Wrap">
Demonstrates the default behaviour with two ListBoxes bound to two collections of the same type.
</TextBlock>
<ListBox Grid.Column="0" BorderThickness="1"
Grid.Row="1"
ItemsSource="{Binding Collection1}"
SelectionMode="Extended"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.UseDefaultEffectDataTemplate="True"
dd:DragDrop.DragAdornerTemplate="{StaticResource DragAdorner}" />
<ListBox Grid.Column="1"
Grid.Row="1"
ItemsSource="{Binding Collection2}"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DragAdornerTemplate="{StaticResource DragAdorner}" />
</Grid>
</StackPanel>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment