WPF 数据网格底部的空行 [英] WPF datagrid empty row at bottom

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

问题描述

我使用

//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?

推荐答案

听起来您可能将 DataGrid 的 CanUserAddRows 设置为 true.只需添加

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

CanUserAddRows="false"

到 XAML.

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

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