Microsoft Developer Network > Página principal de foros > Windows Presentation Foundation (WPF) > WPF “TextBox” controls do not correctly group regular text and special characters as one unit when double clicking to highlight text (Please Vote/Validate)
Formular una preguntaFormular una pregunta
 

Debate generalWPF “TextBox” controls do not correctly group regular text and special characters as one unit when double clicking to highlight text (Please Vote/Validate)

  • domingo, 28 de septiembre de 2008 18:12Jason Webb Medallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Hi, I originally posted this in the "regular" WPF forum, but actually I think this issue more accurately should have been put here instead, as it involves more WPF design rather than code, so I'm also posting it in this forum.

    Anyway, working with a group of developers using WPF, we all love it, but one thing that frustrates both ourselves and our users is the “TextBox” control and the edible “ComboBox” control both don’t handle special characters (such as the @ symbol, or a period, or a backslash) alongside regular text the same and familiar way that both MFC and Windows Forms text box controls do when selecting a certain area and double clicking on it, and I think it’s crucial that this gets fixed so WPF text boxes can gain the full functionally that the MFC and Windows Forms “TextBox” and “ComboBox” controls have.

    In MFC and Windows Forms “TextBox” and “ComboBox” controls, when one or more special characters (such as a period, a colon, or the @ symbol, etc) are associated with words as being part of a single phrase, when a user double clicks on text with one or multiple special characters next to the text, the whole combination of text and special characters will all be selected, just the same way a single word would be selected. For example, an E-mail address is always considered one phrase, so if you double click on anywhere on an E-mail address typed in a “TextBox” of “ComboBox”, such as jasonw15@msn.com, which has an @ symbol and a period, the entire E-mail address will be selected in MFC and Windows Forms apps.

    However, the WPF “TextBox” control and edible “ComboBox” control both don’t group special characters together along with regular text when double clicking on a certain area to select a an item, and instead they treat text and special characters as separate entities, even when they’re right next to each with no spaces, and this is not how and “TextBoxes” and “ComboBoxes” are designed to work in Windows, ever since the first “Text Boxes” in Win95.

    For example, if I have jasonw15@msn.com typed in a WPF “TextBox” or “ComboBox”, and I double click on the jasonw15 part of the address expecting to have the whole E-mail address selected like all Windows apps are supposed to, it will instead only select the jasonw15 part of the E-mail address, and the @msn.com will remain unselected. If you clicked on the jasonw15 part of an E-mail address in an MFC or Windows Forms app, as mentioned above, the entire E-mail will be highlighted, as these apps see this as one phrase, like they should. This flaw in WPF “TextBoxes”/”ComboBoxes” can be replicated with any variety of text and special characters right next to each other…. For another example, if you have http://www.msn.com in a WPF “TextBox” or “ComboBox” and you double click on the word “msn” expecting the whole address to selected, only the word “msn” would be selected, and http://www. and .com would not be highlighted, unlike how MFC and Windows Forms apps would select the entire address, so this seems to be a big flaw to fix in WPF controls so they can act like all of their other counterparts in Windows Forms and MFC apps.

    I made a demonstration video at http://jasonw15.741.com/special-characters.wmv that truly showcases this bug/flaw in great detail. It’s short and quick, so be sure to check it out (size is 15 MB). Please watch this video in its entirety and DO NOT seek with the seek bar, as the “WMV9 Screen” codec has a problem seeking, and it will often cause the video to hang for some time.

    For users who want to test this right away and don’t want to open up Visual Studio to make your own apps in order to reproduce this bug, I made an example WPF C# program with a “TextBox” control and a “ComboBox” control that you can reproduce the bug in, and I made an example Windows Forms C# program that also has a “TextBox” control and a “ComboBox” control that you can see behaves exactly like all other Windows programs and selects the entire phrase of text when you double click on it, unlike the WPF example app. You can find the WPF example app at http://jasonw15.741.com/WPF-Example.zip and the Windows Forms example app at http://jasonw15.741.com/WinForms-Example.zip

    With .NET 3.5 SP1 out now, MS is working hard on updating and creating new controls for the next release of Visual Studio and the .NET Framework, as well as standard controls for Windows 7, which is widely assumed to have a WPF GUI.

    Anyway, if you agree that this flaw takes away standard Windows GUI functionality and “needs” to be fixed in order for WPF programs to act like all other programs in regards to Text controls, please go to https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=367347 and Validate it and Vote for it with a 5 star rating. At the page, there’s much more detailed info about the bug for you to further explore. I’m hoping to get enough support so I can contact some people I know at the .NET team at MS about this issue, but I’m looking to see if it can get as much positive feedback as possible before I contact them, so you’re support matters with each vote and validation. Feel free to leave your own personal comments as well, as some current voters already have. Thanks so much!

    Jason Webb


    Here's an image that showcases this flaw very accurately:




    • CambiadoMarco Goertz - MSFTMSFTlunes, 29 de septiembre de 2008 16:34WPF Framework question (Moved from Visual Studio WPF Designer to Windows Presentation Foundation (WPF))
    •  

Todas las respuestas

  • lunes, 29 de septiembre de 2008 16:37Marco Goertz - MSFTMSFTMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuarioMedallas del usuario
     
    Jason,

    Thank you for your detailed post. I have moved it back to the WPF forum because the WPF Designer forum handles questions regarding the Visual Designer for WPF inside of Visual Studio. You have better chances of getting your question answered in the actual WPF forum.
    Marco Goertz \ Sr. Dev Lead \ WPF Designer "Cider" \ Microsoft