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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
tjgilbertAuthor 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.