[WPF Bug list] (sequence) and (1) -- multiple choice ListBox

Source: Internet
Author: User

Since the release of. NET 3.0,. NET Framework has successively released. NET 3.5 and. NET3.5 SP1. Two WPF-based projects were created. It is found that the current wpf bug is not very small. It has brought a lot of troubles to program development-to avoid bugs, you have to write a lot more code.

 

This "wpf bug list" series will list the various WPF problems that the author has encountered in the project. It may not be a BUG, but it may cause inconvenience in development. I feel that the first release of WPF is suspected of catching up with ducks. A lot of things are released before they are done. (Same as Silverlight 1.0)

 

Let's look at the simplest BUG. BUG in ListBox selected in WPF.

1 <Window x: Class = "ListBoxSelectionBug. DemoWindow"
2 xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns: sys = "clr-namespace: System; assembly = mscorlib"
5 xmlns: forms = "clr-namespace: System. Windows. Forms; assembly = System. Windows. Forms"
6 Title = "ListBox Selection Bug Demo" Height = "300" Width = "300">
7 <DockPanel Margin = "12">
8 <Label Content = "a few clicks. They should all be single-choice. "
9 DockPanel. Dock = "Top"/>
10 <GroupBox Header = "WPF ListBox"
11 DockPanel. Dock = "Top"
12 Padding = "9" Margin = "0, 0, 0, 12">
13 <ListBox SelectionMode = "Single">
14 <sys: String> A string value </sys: String>
15 <sys: String> A string value </sys: String>
16 <sys: String> A string value </sys: String>
17 </ListBox>
18 </GroupBox>
19 <GroupBox Header = "Forms ListBox" Padding = "9">
20 <WindowsFormsHost>
21 <forms: ListBox>
22 <forms: ListBox. Items>
23 <sys: String> A string </sys: String>
24 <sys: String> A string </sys: String>
25 <sys: String> A string </sys: String>
26 </forms: ListBox. Items>
27 </forms: ListBox>
28 </WindowsFormsHost>
29 </GroupBox>
30 </DockPanel>
31 </Window>
32

 

The above source code also lists the ListBox of WPF and The ListBox of WinForm for comparison. Note that on The ListBox of WPF, It is specially marked as a single-choice list box. But the result is like this.

 

Figure 1. WPF ListBox Selection Bug

 

These values are directly put in ListBox. Result The WPF ListBox treats several strings with the same value as the same string and converts them into a ListBox with multiple election values.

 

From. NET 3.0 to. NET 3.5 SP1, the BUG is still in WPF. I don't know if Microsoft doesn't think this is a BUG?

 

PS: do not recommend that you put ListBoxItem in ListBox.EscapeThis problem.

 

In the next few articles, we will continue to expose some WPF bugs or inconveniences for you (basically all controls have a share .), You are welcome to supplement the bugs you have found. After all, your knowledge is limited. I hope to give you some tips.

Below are some plans. (The actual order may be different .)

 

[WPF Bug list] (2) -- The IsChecked binding of RadioButton is invalid.

[WPF Bug list] (3)-dialog box for opening a file for secretly creating a file

[WPF Bug list] (4) -- click RadioButton to return Blank

[WPF Bug list] (5) -- hide the modal dialog box and convert it to non-modal Mode

[WPF Bug list] (6) -- The IsCancel attribute of the Button is invalid

[WPF Bug list] (7) -- stubborn Error Template

[WPF Bug list] (8) -- MaxHeight in RowDefinition fails under certain conditions

[WPF Bug list] (9) -- disappears the cursor

 

......

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.