Version

Configuring Read-only Fields and Disabling Field’s Cells (xamDataPresenter)

Topic Overview

Purpose

This topic describes how to disable a particular field’s cells and how to set a field to be read-only in the xamDataPresenter™ controls.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This section defines the major elements that constitute the controls that make up The Data Presenter Family.

This topic describes how to add a xamDataGrid control to your page.

In this topic

This topic contains the following sections:

Configuring Read-only Field

Overview

In some cases, you may want to prevent the user from editing Field data through the UI in the xamDataPresenter controls. In order to do that, set the Field IsReadOnly property to true.

Note that, you still can modify the editor’s value through code.

The default value of the IsReadOnly property is null which resolves to false.

Property settings

The following table maps the desired configuration to the property settings that manage it.

In order to: Use this property: And set it to:

Set a Field as read-only

true

Example

Following is the code that implements this example.

In XAML:

<igDP:TextField Name="SKU" Label="Product SKU" IsReadOnly="True" />

Disabling a Field’s Cells

Overview

You can disable a Field’s cells in the xamDataPresenter controls.

Property settings

The following table maps the desired configuration to the property settings that manage it.

In order to: Use this property: And set it to:

Disable a Field’s cells in add records

false

Disable a Field’s cells in data records (i.e. not add records or filter records)

false

Example

Following is the code that implements this example.

In XAML:

<igDP:TextField Name="ProductID" Label="ID" IsEnabled=" IsEnabledInAddRecord=" />

Enabling or Disabling Specific Cells

Overview

You can enable or disable a specific Cell in the xamDataPresenter controls to override the setting on its associated Field.

Property settings

The following table maps the desired configuration to the property settings that manage it.

In order to: Use this property: And set it to:

Enable a Cell

IsEnabled

true

Disable a Cell

IsEnabled

false

Example

Following is the code that implements this example.

In C#:

void XDG1_InitializeRecord(object sender, InitializeRecordEventArgs e)
{
    var dr = e.Record as DataRecord;
    if (dr != null)
    {
        dr.Cells["SKU"].IsEnabled = false;
        dr.Cells["ProductID"].IsEnabled = true;
    }
}

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic describes the xamDataPresenter and xamEditors controls.

This topic describes how to create a section in your Window for data entry tasks using XAML.

This topic describes how to access cell values in the active Record through xamDataPresenter RecordActivated event.

This topic describes how to modify a xamDataPresenter control selection functionality for Cells, Records, and Fields.

This topic lists the data type and the editor that is registered to edit it by default in the xamDataPresenter controls.

This topic describes how to embed any control into a cell by creating a custom template.

This topic describes how to embed xamEditor control into a cell by creating a custom style.