Is there a way to automatically capitalize all input thoughtout a WPF app?
+11
A:
You can case all input into TextBox
controls with the following property:
CharacterCasing="Upper"
To apply to all TextBox
controls in the entire application create a style for all TextBox
controls:
<Style DataType="{x:Type TextBox}">
<Setter Property="CharacterCasing" Value="Upper"/>
</Style>
Josh G
2009-05-07 18:14:40
I know this doesn't solve ALL input casing, but most text input would come in through TextBox controls.
Josh G
2009-05-07 18:15:28
Wow. I feel like I don't know anything about WPF again... Thanks!!!
a_hardin
2009-05-08 14:43:42
+1
A:
I recommend creating a custom Textbox class and override an event to automatically capitalize the text. First, this depends on if you want the text to be capitalize as they type or after input is finished.
E.g. for after input is finished
public class AutoCapizalizeTextBox: TextBox
{
public AutoCapitalizeTextBox()
{
}
public AutoCapitlizeTextBox()
{
}
protected override void OnLostFocus(EventArgs e)
{
this.Text = this.Text.ToUpper();
base.OnLostFocus(e);
}
}
Lucas B
2009-05-07 18:34:31
A:
I don't know if this'll help, it capitalizes all the first letters in the sentence.
http://www.mardymonkey.co.uk/blog/index.php/2010/01/auto-capitalise-a-text-control-in-wpf/
Kier
2010-02-04 00:45:02