Home > DeveloperSection > Forums > WPF datagrid empty row at bottom
Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    September-21-2013 7:32 AM


 1 Reply(s)
 3898  View(s)
Rate this:

I bind my datagrid using

//fill datagrid

public DataTable GameData




        DataSet ds = new DataSet();

        FileStream fs = new FileStream(IMDB.WebPage.Class.Config.XMLPath,

        FileMode.Open, FileAccess.Read);

        StreamReader reader = new StreamReader(fs, Encoding.Default);



        DataTable temp = ds.Tables[0];

        return ds.Tables[0];



For some reason I get an empty row at the bottom. And sometimes after clicking on some buttons and checkboxes in the grid, more empty rows are added.

Why is this? And how do I block this?

Sumit Kesarwani

Total Post:378

Posted on    September-21-2013 8:03 AM

Hi Ankita,

If you're creating DataGrid through Source Code...

DataGrid grid = new DataGrid();

grid.CanUserAddRows = false;


grid.AutoGenerateColumns = false;

grid.Margin = new Thickness(10,20,10,10);

grid.VerticalAlignment = VerticalAlignment.Top;

grid.ItemsSource = //... and so on

Don't want to miss updates? Please click the below button!

Follow MindStick