We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Several questions on SfDataGrid

Hi,

I'm working with two SfDataGrid's, and I allow the user to drag data from one SfDataGrid to the other.
 
1. Is it possible to view different columns on each SfDataGrid?
In the example I added I want to view columns name and age on the left table and columns rollno, name and grade on the right one,
So that dragging from one table to the other will result in displaying the correct data on each column


2. Is it possible to disable the gray row highlight that occur when I press on a row?

3. Is it possible to drag and drop without moving the row to the other table? Just copy - paste it.
 

Regards,

Dov

Attachment: RowDragandDropInSfDataGrid_WPF_66bae51f.rar

4 Replies

DO Dov August 31, 2016 10:00 AM UTC

I've managed to solve Q. 3 by myself.

Dov.


JG Jai Ganesh S Syncfusion Team August 31, 2016 02:06 PM UTC

Hi Dov, 
 
Please find the responses for your queries as below, 
 
Query 1: 
 
You can show the different columns on each SfDataGrid by wiring the AutoGeneratingColumn event like below, 
 
this.sfdatagrid.AutoGeneratingColumn += sfdatagrid_AutoGeneratingColumn; 
this.sfdatagrid1.AutoGeneratingColumn += sfdatagrid1_AutoGeneratingColumn; 
 
void sfdatagrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e) 
{ 
    if (e.Column.MappingName == "RollNo" || e.Column.MappingName == "Grade") 
        e.Cancel = true; 
 
} 
 
void sfdatagrid1_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e) 
{ 
    if (e.Column.MappingName == "Age") 
        e.Cancel = true; 
} 
 
Please find the sample for this from the attached location. 
 
If we misunderstood your requirement, then please share a more detail for your requirement. This would be more helpful for us to proceed further. 
 
Query 2: 
 
You can disable the gray row highlight for the selected row by setting the RowSelectionBrush as Transparent like below, 
 
<syncfusion:SfDataGrid x:Name="sfdatagrid" 
                               Grid.Column="0" 
                               ItemsSource="{Binding Stud}" 
                               AutoGenerateColumns="True"                                                               
                               SelectionMode="Single" 
                               RowSelectionBrush="Transparent" 
                               AllowEditing="True"   
                               AllowDrop="True" 
                               AllowFiltering="False" 
                               AllowGrouping="True" 
                               ShowRowHeader="True"  
                               ShowGroupDropArea="False" 
                                
                               /> 
 
 
Regards, 
Jai Ganesh S 



DO Dov September 1, 2016 01:56 PM UTC

Thank you very much. It's working great.


JG Jai Ganesh S Syncfusion Team September 2, 2016 01:59 AM UTC

Hi Dov, 
 
Thank you for the update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon