CharacterCasing 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定在 TextBox 控制項中手動輸入之字元的大小寫。
public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing =
Public Enum 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 字元。