This question is locked. New answers and comments are not allowed.
Hello,
I am having a problem pasting data from Excel into a Grid that is bound to an ObservableCollection when the Grid also has hidden columns. I have the following:
Lets say that Parcel detail has three properties of String (Col1, Col2, Col3)
In the DataLoaded event I hide Col2.
My Sample Excel Data is:
Row1Col1 Row1Col2
Row2Col1 Row2Col2
If I paste this into the grid I end up with my XXXCol1 in the first Column but the second column is empty
Now if I change my Sample Excel Data to:
Row1Col1 Row1Col2 Row1Col3
Row2Col1 Row2Col2 Row2Col3
And I paste this in I get XXXCol1 in the first Column and XXXCol3 in the second column
From what I can tell is that the paste isn't actually happening into the grid itsself but rather the underlying object which is why hiding columns isn't doing what I expect. Is there any recommended way to handle this scenario? I allow my users to select what columns to hide before showing the grid so I cannot hard code any type of column hide because I will not know beforehand.
I am having a problem pasting data from Excel into a Grid that is bound to an ObservableCollection when the Grid also has hidden columns. I have the following:
Dim coll As ObservableCollection(Of ParcelDetail) = New ObservableCollection(Of ParcelDetail)
GridViewExcel.ItemsSource = coll
Lets say that Parcel detail has three properties of String (Col1, Col2, Col3)
In the DataLoaded event I hide Col2.
My Sample Excel Data is:
Row1Col1 Row1Col2
Row2Col1 Row2Col2
If I paste this into the grid I end up with my XXXCol1 in the first Column but the second column is empty
Now if I change my Sample Excel Data to:
Row1Col1 Row1Col2 Row1Col3
Row2Col1 Row2Col2 Row2Col3
And I paste this in I get XXXCol1 in the first Column and XXXCol3 in the second column
From what I can tell is that the paste isn't actually happening into the grid itsself but rather the underlying object which is why hiding columns isn't doing what I expect. Is there any recommended way to handle this scenario? I allow my users to select what columns to hide before showing the grid so I cannot hard code any type of column hide because I will not know beforehand.