Hello,
Dim gridStyle As System.Windows.Style = New System.Windows.Style(GetType(CellValuePresenter))
gridStyle.Setters.Add(New System.Windows.Setter(CellValuePresenter.BorderThicknessProperty, New Thickness(0.099, 0, 0.099, 0.099)))
gridStyle.Setters.Add(New System.Windows.Setter(CellValuePresenter.BorderBrushProperty, System.Windows.Media.Brushes.Black))
Here(above) I have prepared style for a cell. Now I want to assign this style to all cells in my xamDataGrid. Below is the way, in which I have to select each individual column and assign the style for each. But for this, code size get increased if columns are large in number. Is there any way to set style of all the cells of xamDataGrid in single line...?
xamGridBuyerAvl.FieldLayouts(0).Fields(0).Settings.CellValuePresenterStyle = gridStylexamGridBuyerAvl.FieldLayouts(0).Fields(1).Settings.CellValuePresenterStyle = gridStylexamGridBuyerAvl.FieldLayouts(0).Fields(2).Settings.CellValuePresenterStyle = gridStyle
Thanking you.
Yes there is.
There are two ways to do this.
If you create the style in the xaml, you can set no x:key and the style will be applied.
The other way is to set it to the XamDataGrid.FieldSettings.CellValuePresenterStyle property.