共用方式為


CharacterCasing 列舉

定義

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

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
繼承
CharacterCasing

欄位

Lower 1

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

Normal 0

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

Upper 2

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

範例

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

<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>
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;
        }
    }
}

Imports System.Windows
Imports System.Windows.Controls

Namespace SDKSample
    Partial Public Class CharacterCasingExample
        Inherits Page
        Public Sub New()
            Dim myStackPanel As New StackPanel()

            'Create TextBox
            Dim myTextBox As 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)
            Me.Content = myStackPanel
        End Sub
    End Class
End Namespace

備註

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

適用於