The Iscancel property of the WPF bug manifest (6)--button is invalid

Source: Internet
Author: User
Tags visibility

In the previous article, described the modal dialog hidden into a modeless bug, many people replied that this is not a bug, I also expressed understanding. Bugs only have meaning under demand, different requirements, and the definition of bugs is not the same. As a framework,. NET can only be achieved in most of the time is in line with the needs of the widest group, it may be said that it qualified. But for the previous description of the problem, would like to add their own consideration.

Window show and ShowDialog for displaying the form (I didn't use the display) and close for closing. Close can no longer use show or ShowDialog to display the form again, otherwise it will throw an exception, so the 5 floor of the GBOXCC reply is wrong. I sympathize with this gboxcc because he thought I was wrong, exactly the way I wrote the code.

If you want to hide without closing a form, it's obviously not possible to use close. Also, cancel all close events to ensure that the form will not be close, and then only hide the form with visibility. After hiding, if you want to show the form again, my first feeling is to use visibility, but I can't find it.

From this perspective, the window class, Show/close, is called only at the start and end, because they cannot be invoked alternately, and after the form shows, the visibility is controlled with visibility because the visibility can be set alternately. I think that's a very natural thing. But the reality of Windows is that the visibility setting will change the value of the Isshowingdialog variable, which is not supposed to be the case on demand alone. So make it a bug and put it out. Colin Han thought it was "designed specifically for a better user experience." ", I do not disagree." And I feel that the Microsoft UX team is not communicating well with the development team, such as the WPF window I mentioned in another article, which does not provide a property to set whether a form will display an icon, which in itself does not fit with Microsoft's own UX Guide.

The person who replied agrees that the form should be displayed again with ShowDialog. Well, this article was born for the second time. Because it is also problematic to display the form again with ShowDialog. Even the code does not have to change, directly with the last code can reproduce the problem. After you use the ShowDialog method to display a form again, the Hide Self button on the form fails. Notice is again, the first time ShowDialog out when the behavior is normal.

Here's an introduction to the Iscancel property, which is explained on MSDN as follows: Gets or sets a value that indicates whether the button is a Cancel button. The user can activate the Cancel button by pressing the ESC key. In fact, I feel that this sentence for beginners is really no help. It's like telling someone. The attribute is to add an ESC key to the button as the shortcut key. You have to close with many of the documents on MSDN to see how this iscancel button in different environments, in fact, it is better to write a code to try it easy.

For the code in the example, Iscancel is equivalent to letting the current form close. This is the easiest way to add a close button to a form (no one). Because this bug is using the previous code. So I'm not going to give you a map. Run it yourself. The logic is as follows:

1. Click the Show Model Dialog button in the example--Displays a modal dialog box.

2. You can close the pop-up box with hide self.

3. Then use Show Model Dialog Pop-up this dialog box.

4. The Hide Self button no longer works.

I am Ms Fan, but I still look at it with a critical eye; Because I am Ms Fan, MS is by far the best choice for most development and entertainment and application perspectives. If one day Linux releases more than MS in most aspects, I will not hesitate to put Linux. However, it is a platform, not a girlfriend, nor "know", do not need to keep a life.

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.