All docs
V20.2
21.1
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
A newer version of this page is available. Switch to the current version.

BaseColumn.IsReadOnlyBinding Property

Gets or sets the binding that determines a cell’s read-only state.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.2.Core.dll

Declaration

[DefaultValue(null)]
public BindingBase IsReadOnlyBinding { get; set; }

Property Value

Type Default Description
BindingBase

null

The binding that associates the read-only state of cells with a property in a data source.

Remarks

The code sample below sets cells in the Progress column as read-only if a task has subtasks:

View Example: Read-only and Enabled State Binding

<dxg:TreeListControl x:Name="treeList"
                     ItemsSource="{Binding Path=EditableDataSource, Source={StaticResource employeeTasks}}">
    <dxg:TreeListControl.Columns>
        <dxg:TreeListColumn FieldName="Name" Header="Task"/>
        <dxg:TreeListColumn FieldName="Employee" Header="Assignee"/>

        <dxg:TreeListColumn FieldName="Status" Header="Progress" 
                            IsReadOnlyBinding="{Binding HasSubtasks}"/>

        <dxg:TreeListColumn FieldName="StartDate"/>
        <dxg:TreeListColumn FieldName="DueDate"/>
    </dxg:TreeListControl.Columns>
    <dxg:TreeListControl.View>
        <dxg:TreeListView x:Name="view" KeyFieldName="ID" ParentFieldName="ParentID"/>
    </dxg:TreeListControl.View>
</dxg:TreeListControl> 
public class EmployeeTask: INotifyPropertyChanged {
    public int ID { get; set; }
    public int ParentID { get; set; }
    public string Name { get; set; }
    public string Employee { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime DueDate { get; set; }  
    public int Status { get; set; }        
    public bool HasSubtasks { get; }

    // ...
} 

Customize Appearance Settings of Read-only Cells

To change the appearance settings of read-only cells, use the ColumnBase.CellStyle property with a trigger. Use the LightweightCellEditor as the style’s target type.

<dxg:TreeListColumn.CellStyle>
    <Style TargetType="dxg:LightweightCellEditor">
        <Style.Triggers>
            <Trigger Property="ReadOnly" Value="True">
                <Setter Property="Background" Value="LightGray" />                               
            </Trigger>
        </Style.Triggers>
    </Style>
</dxg:TreeListColumn.CellStyle>

 

For more information, refer to Disable Editing.

See Also