This example demonstrates how to use the WPF ColorEdit control to customize the background color of grid UI elements.
The GridControl.Background property specifies the background color of UI elements such as column headers, the group panel, and the row indicator.
The GridControl.DataAreaBackground property specifies the background color of data cells and group rows.
<dxg:GridControl Grid.Column="0"
Background="{Binding SelectedColor, Converter={dxmvvm:ColorToBrushConverter}}"
DataAreaBackground="{Binding DataAreaSelectedColor, Converter={dxmvvm:ColorToBrushConverter}}"
ItemsSource="{Binding Items}"
AutoGenerateColumns="AddNew" Grid.ColumnSpan="3">
<dxg:GridControl.View>
<dxg:TableView EnableSelectedRowAppearance="False"/>
</dxg:GridControl.View>
</dxg:GridControl>
public class MainViewModel : ViewModelBase {
public Color SelectedColor {
get { return GetProperty(() => SelectedColor); }
set { SetProperty(() => SelectedColor, value); }
}
public Color DataAreaSelectedColor {
get { return GetProperty(() => DataAreaSelectedColor); }
set { SetProperty(() => DataAreaSelectedColor, value); }
}
public virtual ObservableCollection<Employee> Items {
get { return GetProperty(() => Items); }
set { SetProperty(() => Items, value); }
}
public MainViewModel() {
Items = Stuff.GetStuff();
}
}
(you will be redirected to DevExpress.com to submit your response)