TextBox.CharacterCasing Property

 

Gets or sets how characters are cased when they are manually entered into the text box.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public CharacterCasing CharacterCasing { get; set; }

Property Value

Type: System.Windows.Controls.CharacterCasing

One of the CharacterCasing values that specifies how manually entered characters are cased. The default is CharacterCasing.Normal.

This property does not affect characters that are added programmatically.

Identifier field

CharacterCasingProperty

Metadata properties set to true

None

The following example shows how to use the CharacterCasing property to convert all manually entered characters to uppercase in a text box.

<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel>

    <!-- The CharacterCasing property of this TextBox is set to "Upper" which 
         causes all manually typed characters to be converted to uppercase. -->
    <TextBox CharacterCasing="Upper" Width="100" />
  </StackPanel>
</Page>
using System;
using System.Windows;
using System.Windows.Controls;
namespace SDKSample
{
    public partial class CharacterCasingExample : Page
    {
        public CharacterCasingExample()
        {
            StackPanel myStackPanel = new StackPanel();

            //Create TextBox
            TextBox myTextBox = new TextBox();
            myTextBox.Width = 100;

            // The CharacterCasing property of this TextBox is set to 
            // "Upper" which causes all manually typed characters to 
            // be converted to upper case.
            myTextBox.CharacterCasing = CharacterCasing.Upper;
            myStackPanel.Children.Add(myTextBox);
            this.Content = myStackPanel;
        }
    }
}

.NET Framework
Available since 3.0
Return to top
Show: