WPF datagrid底部的空行 [英] WPF datagrid empty row at bottom

查看:363
本文介绍了WPF datagrid底部的空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

//fill datagrid
public DataTable GameData
{
    get
    {
        DataSet ds = new DataSet();
        FileStream fs = new FileStream(IMDB.WebPage.Class.Config.XMLPath,
        FileMode.Open, FileAccess.Read);
        StreamReader 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 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?

推荐答案

听起来像你可能有 CanUserAddRows 设置为true为DataGrid。只需添加

Sounds like you probably have CanUserAddRows set to true for the DataGrid. Just add

CanUserAddRows="false"

到XAML。

这篇关于WPF datagrid底部的空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆