Lire en anglais

Partager via


CharacterCasing Énumération

Définition

Spécifie la casse de caractères tapé manuellement dans un contrôle TextBox.

C#
public enum CharacterCasing
Héritage
CharacterCasing

Champs

Nom Valeur Description
Lower 1

Les caractères tapés dans un TextBox sont convertis en minuscules.

Normal 0

Les caractères tapés dans un TextBox ne sont pas convertis.

Upper 2

Les caractères tapés dans un TextBox sont convertis en majuscules.

Exemples

L’exemple suivant montre comment utiliser la CharacterCasing propriété pour convertir tous les caractères en majuscules entrés manuellement dans un 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;
        }
    }
}

Remarques

La valeur de cette énumération n’affecte pas les caractères ajoutés à un TextBox par programmation.

S’applique à

Produit Versions
.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