MattNorman
Well-known member
- Joined
- May 22, 2021
- Messages
- 98
- Programming Experience
- 1-3
I have the following style that I am using for my menu:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I want to also change the foreground color of the text block when the radio button is checked.
I have tried a few different things including adding control template triggers or adding the property change to the style triggers however neither made any difference.
I can get this working by binding colors from my main view model but seems like a lot of extra properties for something I should hopefully be able to do in the style template.
Appreciate any help that can be offered.
	
		
			
		
		
	
				
			
			
				C#:
			
		
		
		    <Style BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="{x:Type RadioButton}" x:Key="MenuButtonTheme">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{TemplateBinding Background}">
                        <TextBlock Text="{TemplateBinding Property=Content}" VerticalAlignment="Center" Margin="40,0,0,0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Focusable" Value="False"/>
        <Style.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Background" Value="#101010"/>
            </Trigger>
        </Style.Triggers>
    </Style>I want to also change the foreground color of the text block when the radio button is checked.
I have tried a few different things including adding control template triggers or adding the property change to the style triggers however neither made any difference.
I can get this working by binding colors from my main view model but seems like a lot of extra properties for something I should hopefully be able to do in the style template.
Appreciate any help that can be offered.
 
	 
 
		 
 
		