Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight DataGridTextColumn Binding Visibility

Following my earlier post I am now trying now to bind the visibility of DataGridColumns to a VM notification property. MSDN suggests I should be able to do this with ease.

I already have a value convertor and VM notification property that I know works (I have tested these on another element on my page:

<CheckBox x:Name="chkAllTeams" Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=AllTeams}"/>

This checkbox control visibility reacts as I would expect. When I set the same binding on the DataTextColumn I get an AG_E_BAD_PARSER error on the Visibility= line of XAML:

<data:DataGridTextColumn 
Visibility="{Binding Converter={StaticResource BoolToVisibilityConverter}, Path=AllTeams}"
/>

Any ideas anyone? Thanks, Mark

like image 900
Mark Cooper Avatar asked Jun 11 '09 19:06

Mark Cooper


1 Answers

Visibility on the DataGridTextColumn is a different beast on the checkbox. Basically, it isn't a dependency property and can't be data-bound. If you need this functionality, you can subclass DataGridTextColumn and add your own dependency property to get the behavior.

  • Rectangle gets its Visibility property from UIElement and is a dependency property
  • DataGridTextColumn gets its Visibility from DataGridColumn and isn't a dependency property.
like image 166
Erik Mork Avatar answered Oct 06 '22 00:10

Erik Mork