如何将childwindow内容绑定到silverlight中的datagrid? [英] How to bind childwindow content to a datagrid in silverlight?

查看:45
本文介绍了如何将childwindow内容绑定到silverlight中的datagrid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含4个字段的数据网格:From,To,Title,Message;以及按钮+和 - 。单击+按钮时,带有3个文本框From,To,Title a和richtextbox的子窗口消息打开我想要做的是:在用户单击确定后添加带有插入值的新单元格(已经有确定并取消和不是有效的电子邮件功能)与exs的相应值:用户点击+和在标题中键入a在From键入a @ aa和在To typed b @ aa richtext中他刚输入一个随机消息后点击在ok中,在网格中添加一个新单元格,每个列中插入的falues来自To a @ aa中的@ aa apears和Title aperas a,如果需要此部分的代码,则在消息中键入的消息将出现该项目让它更容易理解只是说它

I have a datagrid with 4 fields: From, To ,Title ,Message ;and to buttons + and -. When the + button is clicked a childwindow with 3 textboxs From, To,Title a and a richtextbox Message opens what i want do to is : add a new cell with the inserted values after the user clicked in ok (already have ok and cancel and not valid email functions)with the respectives values for ex :the user clicked in + and in the Title typed a in the From typed a@a.a and in the To typed b@a.a the richtext he just typed a random message after that he clicks in ok and a new cell is added in the grid with the inserted falues in each colum From a@a.a apears in the To b@a.a and in the Title aperas a in the Message the message he typed appers if need the code of this part of the project to make it more easy to understand just say it

推荐答案

假设你有一些List< email> list,绑定到datagrid。电子邮件是您的类,其中包含From,To,Title和Message属性。

因此,当您在子窗口上单击OK时,您需要创建一个Email类型的对象并将值分配给From,To ,给该对象的消息。使用用户输入的数据填充电子邮件对象后,只需将对象添加到已绑定到datagrid的电子邮件列表中。



您将在子窗口中看到用户输入详细信息的新行。



希望这个帮助你。
Let say you have some List<email> list, which is bound to datagrid. Where Email is your class which has the properties From,To,Title and Message.
So when you click OK on child window, you need to create an object of type Email and assign the values From,To,Message to that object. Once Email object is populated with the user entered data, just add the object to your email list which is already bounded to datagrid.

You ll get to see the new row with user enterd details in child window.

Hope this helps you.


这篇关于如何将childwindow内容绑定到silverlight中的datagrid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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