Link to home
Start Free TrialLog in
Avatar of tjgilbert
tjgilbert

asked on

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
Avatar of Silverlay
Silverlay

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

----------------
x is your datagrid name
Avatar of tjgilbert

ASKER

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?
Avatar of Aaron Jabamani
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.
ASKER CERTIFIED SOLUTION
Avatar of tjgilbert
tjgilbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial