Condividi tramite


DataGridColumn.IsReadOnly Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether cells in the column can be edited.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Property IsReadOnly As Boolean
public bool IsReadOnly { get; set; }
<sdk:dataGridColumn IsReadOnly="bool"/>

XAML Values

Property Value

Type: System.Boolean
true if cells in the column cannot be edited; otherwise, false. The default is false.

Exceptions

Exception Condition
InvalidOperationException

When setting this property to false on a column derived from DataGridBoundColumn, the column Binding property indicates a data source that is read-only.

-or-

When setting this property to true on a column with a cell that is in edit mode, the cell edit cannot be committed or reverted.

Remarks

If the DataGridColumn.IsReadOnly property and the DataGrid.IsReadOnly property are both set, a value of true will take precedence over a value of false.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.