* net-current-v30plus-md.md * net-current-v40plus-md.md * tla2sharptla-ui-md.md * tla2sharptla-uiautomation-md.md * tla2sharptla-winclient-md.md * tla2sharptla-xaml-md.md * tlasharptla-ui-md.md * tlasharptla-uiautomation-md.md * tlasharptla-winclient-md.md * tlasharptla-xaml-md.md * fix warnings
1.3 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | ||
|---|---|---|---|---|---|
| How to: Make a TextBox Control Read-Only | 03/30/2017 |
|
e707ec59-8b22-473e-b77c-3060a237517a |
How to: Make a TextBox Control Read-Only
This example shows how to configure a xref:System.Windows.Controls.TextBox control to not allow user input or modification.
Example
To prevent users from modifying the contents of a xref:System.Windows.Controls.TextBox control, set the xref:System.Windows.Controls.Primitives.TextBoxBase.IsReadOnly%2A attribute to true.
[!code-xamlTextBox_MiscCode#_ReadOnlyTextBoxXAML]
The xref:System.Windows.Controls.Primitives.TextBoxBase.IsReadOnly%2A attribute affects user input only; it does not affect text set in the Extensible Application Markup Language (XAML) description of a xref:System.Windows.Controls.TextBox control, or text set programmatically through the xref:System.Windows.Controls.TextBox.Text%2A property.
The default value of xref:System.Windows.Controls.Primitives.TextBoxBase.IsReadOnly%2A is false.