.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > Color of checked radio button
 

Color of checked radio button

hi all,

I have noticed a strange problem with Radio buttons.

My radio button is in a wrap panel as below. All is fine if i run the app under vista. But if i run the app using XP or server2003, the selected radio button appears to a white color. I can just about see it in XP but can not see anything when selecting the button in server 2003.

My foreground is settoa white font, does this make a selected radio button be white in xp and server 2003? I there a method to set the color of the checked radio button?

Thanks a million for any advice,
ro

<WrapPanel Margin="0,0,25,19" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="331" Height="35">

<RadioButton Background="White" Foreground="White" x:Name="radioLast7" Content="Last 7 Days" VerticalAlignment="Bottom" HorizontalAlignment="Right" Checked="radioLast7_Checked" IsChecked="True"></RadioButton>

llows

ronan001
ronan001,
I have noticed that in Windows Classic Theme used by XP and 2003, the selected item color changes automatically to have a high contrast with the rest of the control. So if you have a light control, it will be dark, and if you have a dark control, it will be light. When you explicitly set the colors for some parts, the other parts still behave the same old way.
I have had to bypass this for customized control by checking the OS version and presenting with a different default template.

Basically, with Themes in Windows, assigning an explicit color to a control could have its consequences. Best would be to use a System.Color so that it changes with Theme to the appropriate look.

Hope this helps.
noorbakhsh
noorbakhsh
Just templating the control. RadioButton does its own drawing as you can confirm by checking its visual children:

VisualTreeHelper.GetChildrenCount(radio)

Bigsby, Lisboa, Portugal - O que for, quando for, é que será o que é... http://bigsby.eu
Bigsby
ronan001,
I have noticed that in Windows Classic Theme used by XP and 2003, the selected item color changes automatically to have a high contrast with the rest of the control. So if you have a light control, it will be dark, and if you have a dark control, it will be light. When you explicitly set the colors for some parts, the other parts still behave the same old way.
I have had to bypass this for customized control by checking the OS version and presenting with a different default template.

Basically, with Themes in Windows, assigning an explicit color to a control could have its consequences. Best would be to use a System.Color so that it changes with Theme to the appropriate look.

Hope this helps.
noorbakhsh
noorbakhsh

The interface of my app is blue to white gradinet color and the radio button was set with a white forerground, so the selected button was white in server 2003 and a gray color in XP. It was a blue color in vista. To solve the probelm for all i set the background of the button to purple, so it can be seen in all three now.

ronan001

You can use google to search for other answers

Custom Search

More Threads

• Subject: Path animation in resource dictionary
• Opening a Feb CTP project with May CTP - OUCH.
• playing raw audio data
• Strange error "Unable to cast object of type 'x' to type 'x'", when running a WPF application in a plugin environment
• WPF 3D Interactive tooltip and popup details view
• SecurityException when displaying loose XAML files
• WPF Datagrid Totals
• change color of children in TreeView?
• Ugly menu fonts
• WPF Validation