Hi,
Iv'e set up a demo app using the XCeed 3.8 trial version and Iv'e run into the following problem: If you manually set the columns for the datagrid and you
set the grid's AllowDrag = "True", the grid tries to initialize a drag operation each time that you click on any row. I load 2000 dummy items into the grid, then click on the first item, hold in shift, scroll down and click on the last item to select all of the items in the grid. Because the grid tries to initialize a drag operation it takes several seconds for the selection to complete.
Note: Iv'e tested this without manually specifying the columns and then the selection does not cause a drag operation to be initialized. Iv'e also tested it with the manually specified columns and the AllowDrag property set to false and then the selection also does not cause any delay, obviously because the grid does not try to initialize a drag operation.
Here is the code for my demo app:
XAML:
<Window x:Class="XceedDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xceed="http://schemas.xceed.com/wpf/xaml/datagrid"
Title="MainWindow" Height="350" Width="525">
<Grid>
<xceed:DataGridControl MinWidth="447" Name="MainGrid" Grid.Row="1" HorizontalAlignment="Stretch" AutoCreateColumns="False" AllowDrag="True">
<xceed:DataGridControl.Columns>
<xceed:Column FieldName="a" Title="a"/>
<xceed:Column FieldName="b" Title="b"/>
<xceed:Column FieldName="c" Title="c"/>
<xceed:Column FieldName="d" Title="d"/>
<xceed:Column FieldName="e" Title="e"/>
<xceed:Column FieldName="f" Title="f"/>
<xceed:Column FieldName="g" Title="g"/>
</xceed:DataGridControl.Columns>
</xceed:DataGridControl>
</Grid>
</Window>
Code Behind:
namespace XceedDemo
{
public class A
{
private string _a;
public string a
{
get
{
System.Diagnostics.Debug.WriteLine("a");
return _a;
}
set { _a = value; }
}
public string b { get; set; }
public string c { get; set; }
public string d { get; set; }
public string e { get; set; }
public string f { get; set; }
public string g { get; set; }
}
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
ObservableCollection<A> items = new ObservableCollection<A>(this.GetEnumerableWithData(2000));
DataGridCollectionView collectionView = new DataGridCollectionView(items);
this.MainGrid.ItemsSource = collectionView;
}
private IEnumerable<A> GetEnumerableWithData(int size)
{
for(int i = 0; i < size; i++)
{
yield return new A() { a = Guid.NewGuid().ToString(), b = Guid.NewGuid().ToString(), c = Guid.NewGuid().ToString(), d = Guid.NewGuid().ToString(), e = Guid.NewGuid().ToString(), f = Guid.NewGuid().ToString(),
g = Guid.NewGuid().ToString() };
}
}
}
}
If I put a breakpoint in any of my class A's properties and iv'e got "Show External Code" in the Visual Studio Call Stack selected we can see the call to prepare the DragDataObject if you click on any row in the grid:
Xceed.Wpf.DataGrid.dll!Xceed.Wpf.DataGrid.DataGridControl.PrepareDragDataObject(System.Windows.Input.MouseEventArgs e = {System.Windows.Input.MouseButtonEventArgs}) + 0x7d bytes
For us to use the Xceed DataGrid in our products we need to be able to do drag operations while using custom columns (so that we can create data templates for the different properties in our data collections). Is there any fix or workaround for the problem?
Regards,
Imri Lubbe