CharacterCasing 列舉

定義

指定在 TextBox 控制項中手動輸入之字元的大小寫。

C#
public enum CharacterCasing
繼承
CharacterCasing

欄位

名稱 Description
Lower 1

TextBox 中所輸入的字元轉換成小寫。

Normal 0

不轉換 TextBox 中所輸入的字元。

Upper 2

TextBox 中輸入的字元轉換成大寫。

範例

下列範例示範如何使用 CharacterCasing 屬性,將所有字元轉換成手動輸入到 TextBox 中的大寫。

XAML
<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <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>
C#
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;
        }
    }
}

備註

這個列舉的值不會影響以程式設計方式新增至 的 TextBox 字元。

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9