wpf-datagrid:在“添加行"中显示信息文本 [英] wpf-datagrid: display infotext in "adding-row"

查看:74
本文介绍了wpf-datagrid:在“添加行"中显示信息文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我有一个数据绑定的DataGrid,它允许用户添加行.这意味着最后一行是占位符,如果用户单击进入,则会生成新的数据记录,并且用户可以编辑其属性.

不幸的是,并非每个用户都知道该功能.
所以我想显示文字
<在此处输入新记录>"
在占位符行的单元格上.

我该怎么做?

Hello!

I have a databound DataGrid, which allows the user to add rows. That means, the last row is a placeholder, and if the user clicks into, a new data-record is generated, and the user can edit its properties.

unfortunally not every user knows that faboulous feature.
So i would like to display the text
"<enter new record here>"
on a cell of the placeholder-row.

how i can do that?

推荐答案

您可以将自定义模板与一些数据触发器一起使用,以说它是否没有有效的记录,然后将模板更改为此新的EnterNewRecordTemplate,它将显示您想要的内容.然后,当他们确实单击它时,触发器将把它设置回普通模板,因为现在您有了数据.

如果我有时间写一个示例,可以稍后再做,但是我希望这可以为您提供在WPF中进行操作的想法.
You could use a custom template with some data triggers to say if it does not have a valid record to then change the template to this new EnterNewRecordTemplate that would show what you would like. Then when they do click on it the trigger would set it back to the normal template because you now have data.

If I have time to write up an example I can later, but i hope this gives you an idea for doing it in WPF.


这篇关于wpf-datagrid:在“添加行"中显示信息文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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