[WPF] radiobutton does not respond to the bug analysis of mouse selection in the header area of the group.

Source: Internet
Author: User

Last night, I saw the WPF bug 4 of Nanke zhishi:Click radiobutton.And then I made some analyses and comments,

However, the analysis is not accurate enough to mislead others' ideas. Sorry. Here I will analyze it from the beginning.

Because Nanke zhishi has already described the bug, here is just to put it simply: Put A radiobutton on the header of groupbox. At this time, the mouse clicks some blank areas of radiobutton and it does not respond.

Let's get down to the point and start exploring this bug:

First, here is the XAML snippet of the Bug (this post was posted from the blog of Nanke zhishi, and I made some modifications to help reproduce the bug ):

Bug in XAML
< Grid Margin = "12"Textblock. fontsize= "36" >
< Grid. rowdefinitions >
< Rowdefinition Height = "1 *"   />
< Rowdefinition Height = "5 *"   />
< Rowdefinition Height = "4 *"   />
</ Grid. rowdefinitions >
< Textblock Margin = "0, 0, 0, 5" Textwrapping = "Wrap" >
< Run Fontweight = "Bold" > Bug description: </ Run >
</ Textblock >
< Border X: Name = "Dummycontainer" Borderbrush = "Red" Borderthickness = "1" Grid. Row = "1" >
< Groupbox X: Name = "Targetgroupbox" Padding = "9" Borderbrush = "Cadetblue" Borderthickness = "10" Background = "Red" >
< Groupbox. Header >
< Radiobutton X: Name = "Targetradiobutton" Content = "Header radiobutton" Groupname = "Header" />
</ Groupbox. Header >
< Groupbox. Content >
< Stackpanel >
< Radiobutton Content = "Common radiobutton" />
< Radiobutton Content = "Common radiobutton" />
</ Stackpanel >
</ Groupbox. Content >
</ Groupbox >
</ Border >

< Groupbox Padding = "9" Grid. Row = "2" >
< Groupbox. Header >
< Radiobutton Content = "Header radiobutton" Groupname = "Header" />
</ Groupbox. Header >
< Groupbox. Content >
< Stackpanel >
< Radiobutton Content = "Common radiobutton" />
< Radiobutton Content = "Common radiobutton" />
</ Stackpanel >
</ Groupbox. Content >
</ Groupbox >
</ Grid >

Click here or click radiobutton in the header area of the hover groupbox. You will find that there is no response. In WPF, many of the UI issues occur on the visualtree, so I took xamlpad and looked at the visualtree generated by this fragment, for example:

In this figure, I marked two places:
1. I marked the Border Area hidden in the targetradiobutton visualtree (with yellow coverage and then reversed with the background color). In this reversed area, the mouse did not respond.
2. On the visualtree, I marked the border hidden in targetradiobutton. the following property browser can see its properties: the background is transparent, and the border brush is white, the Border width is 10 for each side, and the radius of the rounded corner is 4 ......

This figure shows the theme style of groupbox. This border is located at the top, and the interface is invisible, but the message is not transparent. When the mouse responds to these areas, the message will not reach the subsequent radiobutton and other controls.

If you are interested, try it on your own.

Conclusion:

1. This is actually a groupbox bug. The actual test is in this area and there is a problem with the UI.
2. in WPF, many bugs seem invisible. You may wish to look at its visualtree.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.