In the WPF bug list bis, a bug that RadioButton on the binding is described. Now it's another one that causes RadioButton click events to handle incorrect bugs. The phenomenon is: point in the range of RadioButton, but this radiobutton is not selected.
Let's take a look at an example. A common dialog box in Windows with multiple radiobutton. As shown in the following figure.
Figure 1. RadioButton Usage Examples
Placing RadioButton on the header of GroupBox is a common use case and is recognized by Microsoft's UX Guide.
You can order these radiobutton on your computer, as long as the point is in the circle or text range, it will be selected.
We now use WPF to achieve this effect. There are many ways to achieve this.
1. Put a radiobutton directly in the header. Simple, not reusable.
2. Use HeaderTemplate, put a radiobutton inside. More complex than the above, the result is the same.
3. Use ControlTemplate, or put a radiobutton inside. Reusability is better.
For the sake of simplicity, let's demonstrate the bug in the first way.
Sample Code
<stackpanel margin=
<textblock margin= "0,0,0,5" textwrapping= "Wrap"
< Run fontweight= "Bold" >bug description:</run>
<Run> slightly </run>
</textblock> ;
<groupbox padding= "9"
<groupbox.header>
<radiobutton conten t= "header RadioButton" groupname= "header"/>
</groupbox.header>
<groupbox.content
<stackpanel>
<radiobutton content= "Common RadioButton"/>
<radiobutton content= "Common RadioButton"/>
</stackpanel>
& Lt;/groupbox.content>
</groupbox>
<groupbox padding= "9"
<groupbox . Header>
<radiobutton content= "header RadioButton" groupname= "header"/>
</gro Upbox.header>
<groupbox.content>
<stackpanel>
<radiobutton content= "C Ommon RadioButton "/>
<radiobutton content=" Common RadioButton "/>
</s Tackpanel>
</groupbox.content>
</groupbox>
</stackpanel>
The effect of the operation is shown below.
Figure 2. RadioButton Click on the Bug sample
PS: Originally want to do a XBAP program put up to let everyone direct point. Results did not find a place to upload. exe.
The source of this bug should be caused by color. When you can find that the mouse is moving on the header RadioButton, only when the mouse is over the color area, RadioButton thinks he is a mouseover. But after deliberately to the RadioButton header set background, the problem remains.
This problem has made our QA and developer at the same time crazy. As a high-quality software, this seemingly small problem is also intolerable. There is a solution, but the ugliness is not to be brought out for everyone to see. Or wait for the man of God or the. NET Framework 4.0.
-----------------------------------------a summary of the split line---------------------------------------
RadioButton currently has two bugs in the account, the first in the WPF bug list. But RadioButton classmate also don't be happy too early, our bug main listbox with its righteousness elder brother ListView still not to have an upset. Button students to give up, as one of the simplest control, but also give us some confidence ah.