Forcing a style trigger to update RRS feed

  • Question

  • I have a RadioButton control that has a style trigger that changes the border & background color when IsChecked becomes true.  When I execute code in the Checked event, it appears that, while IsChecked = true, the style trigger hasn't occurred yet.  How can I force the trigger update  - I'd like to see the visual change before the logic in the Checked event does a data access call?

    Friday, August 10, 2007 9:07 PM

All replies

  • I'm not sure, but I don't think you can do that, maybe you could declare the "IsChecked style" in your resources, and apply it manually in your Checked event?



    Friday, August 10, 2007 11:39 PM
  • Hello, the problem maybe, RadioButton’s Background only affects the small circle, not its Content. So the change may be difficult to notice. You can instead set a Background for the BulletDecorator in ControlTemplate:

    <ControlTemplate TargetType="{x:Type RadioButton}">

             <BulletDecorator x:Name="bulletDecorator" Background="#FFFF0000">


                                <Microsoft_Windows_Themes:BulletChrome Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" IsChecked="{TemplateBinding IsChecked}" IsRound="true" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}"/>


                       <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>



                      <Trigger Property="IsChecked" Value="True">

                               <Setter Property="Background" TargetName="bulletDecorator" Value="#FF0000FF"/>





    Monday, August 13, 2007 10:14 AM
  • Thanks for the assistance.  However, I've re-styled the radio button such that changing the background color does highlight the entire item.

    Monday, August 13, 2007 2:03 PM
  • You could call Dispatcher.BeginInvoke and post a callback. That should get you to a point after all the style updates have occurred. Then, you can perform your desired operations.




    Tuesday, August 21, 2007 6:22 PM