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):
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
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”
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.
When using the expression on the DxDataGrid rows, always use @RowData.Row.field_name.
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):