views:

30

answers:

2

Hi,

How could I make the Datagrid display the headers in case there's no row to display?

My Datagrid is "completely" read-only with:

"AutoGenerateColumns ="True" "CanUserAddRows="False" "CanUserDeleteRows="False" "CanUserResizeRows="False" "IsReadOnly"="True"

If there's no row, then the headers aren't displayed, if I add even an empty row, then the headers are shown!

Until now, I couldn't find any workaround/solution for that!

Thx all

Fred

A: 

AFAIK If there are no rows then there are no columns and the column headers will not display. This is the same for the rows. If there are no rows then there are no row headers. This is by design and I think it is the way it should be.

Now to get your headers you could add an empty row and make it invisible? And remove this row when you add rows with content.

Martino
Well, the workaround with the hidden row would be ok too, but how can I hide a row?
Fred
row.IsVisble = false;
Martino
A: 

Hi,

Well, what I want sounds realy simple and trivial, but in fact, it isn't so easy! In the wpf toolkit datagrid, I couldn't find a simple way to access a specific row and a specific cell!

It there no way to show the header without playing with a blank row and setting it to hidden?

thx

Fred