Reputation: 10175
I have this datagridtemplatecolumn of mine which I would like to bind to a property on my project page which has a type of System.Windows.Visibility. The problem is that whenever im compiling the XAML Below is it throws me an error like this in blend: "System.Windows.Data.Binding cannot be converted to System.Windows.Visibility" and in Runtime it throws an error like this 'Set property 'System.Windows.Controls.DataGridColumn.Visibility' threw an exception.'
<sdk:DataGridTemplateColumn Header="Settings" IsReadOnly="True" Visibility="{Binding ElementName=projectPage, btnEditVisibility}">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid x:Name="grdEditCell" ToolTipService.ToolTip="Edit Project" >
<sdk:Label Content="Edit" IsEnabled="{Binding isBtnEditEnabled, ElementName=projectPage}" Visibility="{Binding btnEditVisibility, ElementName=projectPage}" HorizontalAlignment="Center" VerticalAlignment="Center" MouseLeftButtonDown="btnEditProject_Click"/>
</Grid>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
Upvotes: 3
Views: 585
Reputation: 9478
What is the grids's ItemsSource set to? Do the same rules apply with element binding where you'd need to use a relative source binding. Also, what is btnEditVisibility? If its a button wouldn't you needed specify the buttons visibility property or use a SomethingToVisibility converter?
Post some more code if possible.
Upvotes: 1