---
title: "WPF datagrid empty row at bottom"  
description: "WPF datagrid empty row at bottom"  
author: "Anonymous User"  
published: 2013-09-21  
updated: 2013-09-21  
canonical: https://www.mindstick.com/forum/1471/wpf-datagrid-empty-row-at-bottom  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# WPF datagrid empty row at bottom

I bind my datagrid using

//fill datagrid

[public](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) [DataTable](https://www.mindstick.com/blog/195/datatable-in-ado-dot-net) GameData

{

get

{

[DataSet](https://www.mindstick.com/articles/19/dataset) ds = new DataSet();

[FileStream](https://www.mindstick.com/interview/34113/what-are-the-differences-between-filestream-flush-flushasync-and-dispose) fs = new FileStream(IMDB.WebPage.Class.Config.XMLPath,

FileMode.Open, FileAccess.Read);

[StreamReader](https://www.mindstick.com/forum/161576/explain-the-difference-between-streamreader-and-file-readalllines) reader = new StreamReader(fs, Encoding.Default);

ds.ReadXml(reader);

fs.Close();

DataTable temp = ds.Tables[0];

return ds.Tables[0];

}

}

For some reason I get an empty [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table) at the bottom. And sometimes after clicking on some buttons and checkboxes in the [grid](https://www.mindstick.com/forum/369/how-can-i-add-a-column-name-to-my-grid), more empty rows are added.

Why is this? And how do I [block](https://www.mindstick.com/forum/157599/explain-the-process-control-block-pcb-in-the-operating-system) this?

## Replies

### Reply by Sumit Kesarwani

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
```


---

Original Source: https://www.mindstick.com/forum/1471/wpf-datagrid-empty-row-at-bottom

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
