Calling a datatrigger for a radio button inside a datagrid

Posted by Farax on Stack Overflow See other posts from Stack Overflow or by Farax
Published on 2010-05-07T06:55:32Z Indexed on 2010/05/07 6:58 UTC
Read the original article Hit count: 367

Filed under:
|
|
|

I have a datagrid with one column having a radio button. I want to set the GroupName when a certain condition is reached. Below is the code

        <Custom:DataGrid.Columns>

                      <!-- ONLY ENABLED WHEN THE ITEM TYPE IS SINGLESELECT OR SINGLESELECT WITH ADDIOTIONAL DATA-->
            <Custom:DataGridTemplateColumn CanUserResize="False" MinWidth="20" >
                <Custom:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <RadioButton IsChecked="{Binding IsChecked}" d:DesignWidth="16" d:DesignHeight="16" GroupName="SingleChoiceSelection" Template="{DynamicResource RadioButtonTemplate}" Background="{DynamicResource BackgroundNew}" BorderBrush="#FF7A7171" Foreground="#FF6C6C6C" Margin="0" />
                    </DataTemplate>
                </Custom:DataGridTemplateColumn.CellTemplate>
            </Custom:DataGridTemplateColumn>


            <Custom:DataGridTextColumn Header="Choices"  Binding="{Binding ChoiceText}"  CellStyle="{DynamicResource DataGridCellStyle2}" MinWidth="150" />


        </Custom:DataGrid.Columns>

    </Custom:DataGrid>

The ItemSource contains a property called isChecked and I want to change the foreground color when isChecked is changed to true. How do i do this with a datatrigger?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about databinding