B.K.
B.K.

Reputation: 10152

Always displaying the first row of a DataGrid, even if it's empty?

It seems it would be very simple, but I can't seem to figure out. The way it is right now, before a query is done and data is added to the DataGrid by binding, the DataGrid is displayed only as its headers, with no rows. I'd like the first row to always be displayed, even before a query is ran, for visual appeal, is there a way to accomplish that?

Upvotes: 1

Views: 979

Answers (2)

Rob Perkins
Rob Perkins

Reputation: 3130

Before binding to your data, insert a blank row: datagrid.Items.Add(0);

Delete the blank row right before querying: datagrid.Items.Remove(0);

(Edited to reflect OP feedback.)

Upvotes: 2

Vulcronos
Vulcronos

Reputation: 3456

Additionally, you could enable adding a row in the DataGrid, it will create an empty row that is editable for you.

Upvotes: 0

Related Questions