EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

TextBox.IsReadOnly Property

May 11, 2014

Gets or sets the value that determines if the user can change the text in the text box.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

'Déclaration
Public Property IsReadOnly As Boolean
<TextBox IsReadOnly="bool"/>

Property Value

Type: System.Boolean
true if the text box is read-only; otherwise, false. The default is false.

Dependency property identifier field: IsReadOnlyProperty.

If the text box is read-only, no user input or edits are allowed, but programmatic changes can be made. The user can still select text, and the cursor still appears. The KeyUp and KeyDown events are marked as handled.

The following code snippet displays a read-only text box.


<TextBlock Margin="20,20,0,0" Text="Read Only TextBox"/>

<TextBox x:Name="ReadOnlyTB"  IsReadOnly="True" HorizontalAlignment="Left" Margin="20,5,0,0" Height="70" Width="200" />


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Afficher:
© 2014 Microsoft