Asked by:
Strange autocorrect behavior on Surface with Type Cover

Question
-
Hi,
Just a small information up front, I don't have a Surface with Type Cover, this is what I heard from a user, I can't reproduce the problem with a normal PC and a none Surface tablet.
I have built a Textbox with auto line break at character X, each time when the courser with the last word jumps in the next line, the word starts capitalized.
This only happens while tipping, not when he just copies the text in, additional he must type with Type Cover, if he uses the virtual keyboard the problem also doesn't show up.
I can't paste the whole code in; here is a piece of code that should have the same problem:
<Page x:Class="App1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <TextBox Grid.Row="2" x:Name="cMessageBox" IsSpellCheckEnabled="True" MinWidth="200" MinHeight="200" TextWrapping="NoWrap" AcceptsReturn="True" FontSize="14.5" Padding="0,20,0,0" FontFamily="Consolas" TextChanged="cMessageBox_TextChanged" /> </Grid> </Page>
public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } private void cMessageBox_TextChanged(object sender, TextChangedEventArgs e) { Windows.UI.Xaml.Controls.TextBox t = sender as Windows.UI.Xaml.Controls.TextBox; if (t != null) { t.TextChanged -= cMessageBox_TextChanged; string text = t.Text; int index = text.LastIndexOf(' '); int indexEnd = text.LastIndexOf('\n'); if (index - indexEnd > 20) { t.Text = text.Insert(index, "\n"); t.SelectionStart = index + 1; } t.TextChanged += cMessageBox_TextChanged; } } }
Thanks
Sunday, August 10, 2014 8:57 AM
All replies
-
Hi Diego2k,
I check the code you provide, but I don’t know what you are doing. From the code, it seems you are control text auto wrap. But there is a TextWrapping property in TextBox control, we use the property to do the same. I’m confused.
>I have built a Textbox with auto line break at character X, each time when the courser with the last word jumps in the next line, the word starts capitalized. This only happens while tipping, not when he just copies the text in, additional he must type with Type Cover, if he uses the virtual keyboard the problem also doesn't show up.
I have no device too. So I test in windows store app project. There is no such issue. My suggestion is try to contact the person to know more information about it.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Dave SmitsMVP Wednesday, August 13, 2014 9:54 AM
Tuesday, August 12, 2014 6:49 AMModerator -
Thanks,
as I said it's only an example code.
What the original code does is exactly a wrap at a specific line length. So for example in newsgroups its customary to don't write lines longer than 72 chars, but there are exceptions, for example with quoted lines. In addition there should be no dependency between width of the TextBox and wrap length ...
I don't think thats possible with the TextWrapping property?What should happen with a Surface is that the word that gets wrapped in the next line automatically starts with a uppercase letter, but on my machines it doesn't ... so a can't reproduce the problem.
Wednesday, August 13, 2014 10:39 AM -
Hi Diego2k,
Sometimes reboot is a good choice to solve strange problem. Try it please.
If we cannot reproduce this problem on the computer, I am going to close this thread. If you have any questions, you are welcome to post here.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Wednesday, August 20, 2014 3:14 AMModerator -
Just for the record, the user contacted me again:
> I use a power cover all the time and the problem only shows up with the Power Cover and only in NewsgroupsRT.> If I use the onscreen or Type Cover 2, things are just as they are supposed to be.
Wednesday, August 20, 2014 7:02 PM