Skip to main content

Microsoft Silverlight

Answered Question Binding to DataGrid column visibilityRSS Feed

(0)

jared.cronin
jared.cr...

Member

Member

1 points

14 Posts

Binding to DataGrid column visibility

I'm trying to bind the visibility of a column to some authorization properties, but I get a parsing error everytime I try to run the application.

 I thought maybe I had a syntax problem with my binding, so I removed the converter I was using and bound straight to a Visibility property on my datacontext...no go.  Still gave a parsing error.

 

Which leads me to ask - Does the datagrid column visibility property support binding?

 

Jared Cronin

amit_pal1979
amit_pal...

Participant

Participant

1150 points

201 Posts

Re: Binding to DataGrid column visibility

Check this link which provides the info on this:

http://www.jeff.wilcox.name/2008/07/13/visibility-type-converter/

 

Please mark the post as 'Answered' if it really Answers your question.

jared.cronin
jared.cr...

Member

Member

1 points

14 Posts

Answered Question

Re: Binding to DataGrid column visibility

Actually, that only hides the contents of the cell.  I am very familiar with creating a visibility converter.  I've created / implemented six or seven different converters.  The problem I'm having is that the datagrid column (particularly the textcolumn) is throwing a parsing error whenever I try to bind a value to the columns visibility property.  Try it for yourself...it's very simple to setup.

Jared Cronin

 

After discussion with some contacts at Microsoft, they have confirmed that you are not able to bind to the visibility of a column on the datagrid.  There may be other properties as well that cannot be bound.

j23tom
j23tom

Member

Member

10 points

8 Posts

Re: Binding to DataGrid column visibility

 So is there any other way to show/hide datagrid's columns  with use of  data binding ?

jared.cronin
jared.cr...

Member

Member

1 points

14 Posts

Re: Binding to DataGrid column visibility

Unfortunately there is no other way to cleanly show / hide columns using databinding (that I know of).  I've tried binding my field access to the width and converting that to a width of 0 or auto with no success.  The datagrid is so powerful, but falls short in this area.

 

Let me know if you find any other alternatives.

Jared Cronin

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities