Version

Binding Field, FieldSettings, FieldLayout and FieldLayoutSettings to MVVM Properties (xamDataPresenter)

Topic Overview

Purpose

This topic describes how to bind the Field, FieldSettings, FieldLayout and FieldLayoutSettings to MVVM properties using the FieldBinding markup extension 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.

This section lists the topics written specifically to help you access data using xamDataGrid control.

This article describes the fundamentals of Binding Markup Extension.

Binding Field and FieldLayout Objects to DataContext

Overview

Use the Field/ FieldLayout DataContext property to facilitate the MVVM binding.

By default, if the Field/FieldLayout DataContext property is not explicitly set, it takes the xamDataPresenter control’s DataContext.

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:

Get or set the data context for a Field or FieldLayout that participates in data binding.

DataContext

object

Binding Field, FieldSettings, FieldLayout and FieldLayoutSettings to MVVM Properties

Overview

Use the FieldBinding markup extension to facilitate the binding of Field, FieldSettings, FieldLayout and FieldLayoutSettings to MVVM properties.

Note
Note

The FieldBinding exposes the same options as Binding except it doesn’t expose the following properties:

  • AsyncState

  • BindingGroupName

  • BindsDirectlyToSource

  • Delay

  • ElementName

  • IsAsync

  • RelativeSource

  • Source

  • ValidatesOnDataErrors

  • ValidatesOnExceptions

  • ValidatesOnNotifyDataErrors

  • ValidationRules

  • XPath

Note
Note

The FieldBinding markup extension throws a XamlParseException if it is used on an object other that a Field or a FieldLayout or when it is bound to a property of type BindingBase (for example - Field’s AlternateBinding property).

Example

The binding to MVVM properties can be implemented in any one of the following ways:

In XAML:

<igDP:Field  Name="Name" Label="{igDP:FieldBinding MyProperty}" />

In XAML:

<igDP:Field Name="Name" Label="{Binding Path=Owner.DataPresenter.DataContext. MyProperty, RelativeSource={RelativeSource Self}}"  />

In XAML:

<igDP:Field Name="Name" Label="{Binding Path=DataContext.MyProperty, RelativeSource={RelativeSource Self}}"  />

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic describes how to data bind the xamDataPresenter controls to an XmlDataProvider to expose your XML file to the presentation layer of your application.

This topic describes how to data bind the xamDataPresenter controls to an ObjectDataProvider to expose your collection to the presentation layer of your application.

This topic describes how to data bind the xamDataPresenter controls to a DataSet.

This topic describes how to bind cell settings to data item properties using the CellBindings collection property in the xamDataPresenter controls.

This topic describes how to find the DataRecord object that corresponds to your data item.

This topic describes how to add your data items directly to the xamDataPresenter control’s DataItems collection.

This topic describes how the xamDataPresenter controls display hierarchical data.

This topic describes how to display an image in a Field overriding the CellValuePresenter’s template.

This topic describes how you can iterate through the nested structure of records as well as what kind of record types you may encounter.