I've spent several hours looking at this with no results.
I simply want to have a DataGrid
with X number of columns that maintains its relative width to the Grid
itself.
So, for example:
I have set up a style that is attached to a DataGrid
item template. I have attempted binding the width to the DataGrid
itself (often a cyclical reference), to another object (the value comes in, but the DataGridColumn
doesn't update), with a Converter (the converter gets the correct value, then sets the value of the column, but despite different numbers coming back, the width of the column never changes).
I've set up a SizeChanged
event on the DataGrid
itself and set the width of the columns specifically, which DID change the values of the columns, but each size event caused another size event, etc... etc...
I'm obviously too stupid to figure this out myself, so if anyone could provide me a simple example of what I imagine should be a simple thing to do, I'd be ever so grateful.
So, just to be clear, ALL I'm looking for is a DataGrid
with X number of columns that maintain a fixed % of the DataGrid
width itself - pretty much like any table in HTML would do natively.
Thanks in advance.
ColumnWidth
property is your friend.
<DataGrid ColumnWidth="*"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With