How to Bind Columns Property of a DataGrid Inside a UserControl?

You cannot bind that property as it is not a dependency property, so just forward it.

Up vote 1 down vote favorite 2 share g+ share fb share tw.

I have a user control with a datagrid inside. I want the caller to be able to do something like this: I tried to do something like this in my usercontrol definition: I have a GridColumns property in the user control. It does not work.

How to do this correctly? Thanks. Wpf link|improve this question edited Oct 6 '11 at 17:21H.B.43k61645 asked Sep 29 '11 at 16:43Diego AC714212 76% accept rate.

For a custom presentation I found the GridView easier to work with. But I could never get it to bind directly to a columns collection. I had to had to enumerate over the collection in code behind and add the columns one at a time.

I hope you get an answer to your question. – Blam Sep 29 '11 at 17:53 When I had the similar task, I created the derived ExtendedDataGrid class where I added the necessary property and implemented autogeneration of columns. But I worked with such bindings like , I mean with bindings to array indexes.

So can you post code of the GridColumns property of your viewmodel? – vorrtex Sep 29 '11 at 18:04.

You cannot bind that property as it is not a dependency property, so just forward it: public ObservableCollection Columns { get { return datagrid. Columns; } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions