Expression Binding

Using expression binding on DataPanel

Hide a DataPanel

In this example we hide the xDataPanel based on the expression binding. We assume that the xDataPanel has the "DataSourcePath" set to "dsArt.art".

Design Mode

XAML initially:

Visibility Expression Binding

XAML after setting Expression Binding for hiding condition (ExfresionBinding found on line 2):

circle-info

Based on this example the xDataPanel (x:Name=dpArt) will be visible if the binding(@artnr) has the value “1000”, if not, the xDataPanel will be collapsed

Set the background color of a xDataPanelItem

Same as the one before we assume that the xDataPanel has the "DataSourcePath" set to "dsArt. art".

Background Expression Binding
circle-info

Based on this example we change the background color of the xDataPanelTextBoxItem (x:Name=txtArtNr). If the binding value (@artnr) is “1000” the color will be red, if not the color is changed to blue.

XAML after setting Binding Expression for Background color (ExfresionBinding found on line 4):

Result:

Value is not “1000”
Value is “1000”

Using expression binding on DxDataGrid

Change the background color of a row based on the binding

We assume that the xDataPanel has the "DataSourcePath" set to "dsArt.arbpl_afo"

XAML initially:

Using expression to change the background color of the row based on “typ” of the row. In this case we need to set he binding to the property of the DxDataGrid(x:Name=” dxgarbpl_afo”) called “RowBackgroundColorBinding”

circle-info

In this case if the binding(@RowData.Row.typ) value is 20, the background-color of the grid row will pe LightGreen, if the value different the color will be set to null.

circle-exclamation

XAML after Expression Binding was set (ExfresionBinding found on line 2):

Result:

Change the color of a cell based on the binding

Using the same expression, but this time on the DxComboBoxColumn(x:Name=”tbAfoTypDG”) will change only the color of the cell.

XAML after Expression Binding was set (ExfresionBinding found on line 4):

Result:

Last updated