Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

[RESOLVED] How to set DataGrid Cell Color

$
0
0
I'm trying to set the cell color of a WPF datagrid. But I can't get this to work.

Code:

                Dim firstRow As DataGridRow = TryCast(DG1.ItemContainerGenerator.ContainerFromItem(DG1.Items(0)), DataGridRow)
                Dim firstColumnInFirstRow As DataGridCell = TryCast(DG1.Columns(0).GetCellContent(firstRow).Parent, DataGridCell)
                'set background
                firstColumnInFirstRow.Background = Brushes.Red


Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>