wpf xceed DataGrid, C#

I am using the wpf xceed DataGrid and binding data to the Data Grid Control.
ItemsSource="{Binding Path=GetData}"

I am using C# and MVVM and the GetData is in my ViewModel file.

I am unable to clear the grid by passing null.  It removes the rows but the columns stay bounded somehow.

I appreciate any suggestions you have.
tjgilbert
tjgilbertAsked:
Who is Participating?
 
tjgilbertConnect With a Mentor Author Commented:
Your right it does keep it's structure and the rows were being cleared but not the columns.
Turns out I had to create a DependancyObjects class and set DepenencyProperty  to clear the columns.
0
 
SilverlayCommented:
just pass any empty IEnumerable like
x.ItemSource = new List<object>();
or call clear on x.Columns.Clear();

----------------
x is your datagrid name
0
 
tjgilbertAuthor Commented:
The problem is I'm not using code behind so I don't have access to the datagrid directly.  I am using View Model.

I have passed null and I have tried passing an empty DataTable.

neither works.

Do you have any other suggestions?
0
 
apeterCommented:
Is your GetData still get the rows ? GetData should return null as itemsource
0
 
SilverlayCommented:
View Model isnt pssing null there its pass collection with none items, but still keeps structure.
Actualy i have no idea how to pass null there from bindings.
0
All Courses

From novice to tech pro — start learning today.