Questions tagged [wpfdatagrid]

New and improved DataGrid control for Windows Presentation Foundation (WPF) applications. Can be bound to a multitude of datasources. Flexible, programmable rendering options to match custom user interfaces.

2377 questions
161
votes
12 answers

How to perform Single click checkbox selection in WPF DataGrid?

I have a DataGrid with first column as text column and second column as CheckBox column. What I want is, if I click the check box. It should get checked. But, it takes two click to get selected, for first click the cell is getting selected, for the…
Prince Ashitaka
  • 8,623
  • 12
  • 48
  • 71
136
votes
5 answers

How can I disable editing cells in a WPF Datagrid?

I'm constructing a datagrid in Windows Presentation Foundation, and I have a problem. When a user double-clicks on a cell in my datagrid, the cell goes into edit mode. I want to prevent that. Instead I want users to be able to select the full row -…
Pouyan
  • 2,849
  • 8
  • 33
  • 39
120
votes
4 answers

How Do I Hide wpf datagrid row selector

I'm using the WPF DataGrid control to show some details and a select button, and I don't need the gray selector column down the left-hand side. It's also ruining the beauty of my design. Is there a way to remove it, or how can I style it to match if…
Tim Almond
  • 12,088
  • 10
  • 40
  • 50
103
votes
4 answers

How to set DataGrid's row Background, based on a property value using data bindings

In my XAML code, I want to set the Background color of each row, based on a value of the object in one specific row. I have an ObservableCollection of z, and each of the z has a property called State. I started out with something like this in my…
Tobias Moe Thorstensen
  • 8,861
  • 16
  • 75
  • 143
96
votes
4 answers

WPF StringFormat on Label Content

I want to format my string binding as Amount is X where X is a property bound to a label. I've seen many examples but the following doesn't work:
Everything Matters
  • 2,672
  • 4
  • 25
  • 42
91
votes
8 answers

Binding ItemsSource of a ComboBoxColumn in WPF DataGrid

I have two simple Model classes and a ViewModel... public class GridItem { public string Name { get; set; } public int CompanyID { get; set; } } public class CompanyItem { public int ID { get; set; } public string Name { get; set;…
Slauma
  • 175,098
  • 59
  • 401
  • 420
81
votes
12 answers

DataGrid's selected row color when inactive

How can I style WPF DataGrid to change the color of selected row when DataGrid lost its focus?
white.zaz
  • 1,116
  • 1
  • 10
  • 15
65
votes
7 answers

Disable DataGrid current cell border in FullRow selection mode

I am using a DataGrid in row selection mode (i.e., SelectionUnit="FullRow"). I simply want to remove the border that is being placed around the current cell when the user highlights a row in order to have true full row selection (and no cell level…
Michael Goldshteyn
  • 71,784
  • 24
  • 131
  • 181
55
votes
5 answers

wpf datagrid alternate row coloring

I have tried this method.. without luck..