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.
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.
just pass any empty IEnumerable like
x.ItemSource = new List<object>();
or call clear on x.Columns.Clear();

x is your datagrid name
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?
Is your GetData still get the rows ? GetData should return null as itemsource
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.
All Courses

From novice to tech pro — start learning today.