I'm new to silverlight, so I don't know if this is obvious or not.
I have a datagrid where the first column is a check box (named "Overridden"). The second column (named "ShowDetails") is a button which allows the user to expand the row to see a nested grid. If the "Overridden" check box is not checked, the "ShowDetails" button should be disabled.
The screen is correct when initially displayed. The "ShowDetails" button is disabled when the initial "Overridden" check box is unchecked. When I check the "Overridden" check box, the "overriddenFlag" is changed, however, the "ShowDetails" button remains disabled, instead of changing to 'enabled'.
Why doesn't the "IsEnabled" flag of the "ShowDetails" button change?
Here are the 2 columns from the xaml
<sdk:DataGrid.Columns>
<sdk:DataGridTemplateColumn Header="Overridden">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding OverriddenFlag,Mode=TwoWay}"
Click="Overridden_Click"
HorizontalAlignment="Center"
/>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
<sdk:DataGridTemplateColumn>
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button x:Name="ShowDetails"
FontWeight="bold" FontSize="12"
Content="+" Click="ShowDetails_Click"
IsEnabled="{Binding OverriddenFlag, Mode=OneWay}"
/>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
What is the proper way to enable/disable a button in a datagrid programmatically?
I've tried to do a variety of things I've seen here in Stack Overflow, such as INotifyProperty, a converter to hide the button (which didn't show the button when I checked the check box), and I've tried to do things in the Overridden_Click fct, such as FindName() - but have had no success.