在WPF C#中的所有子窗口中打开相同的内容 [英] Same content open in all child windows in WPF C#

查看:108
本文介绍了在WPF C#中的所有子窗口中打开相同的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我使用的列表框包含了收藏。我已经在列表框中绑定了一些集合并选择了项目。所选项目将在新窗口中打开。我们可以打开多个窗口。

当我们双击所选项目时,它将在窗口中打开内容。但是在最后选择的项目中有一个问题将在所有打开的子窗口中打开。



例如,在第一个窗口中我打开Customerid-101,然后打开第二个customerid-102表示第一个窗口也有Customerid-102的记录。



您能否提供解决方案来解决这个问题。



先谢谢。



问候,

Arunkumar M

Hi Everyone,

I have used list box with contains the collections. I have binded some collections in the list box and having selected item. The selected item will open in new window. We can open multiple windows.
It will open the content in a window while we double click the selected item. But there is a problem in last selected item will open in all the opened the child windows.

For Example, in first window i open Customerid-101 and second i open customerid-102 means the first window also having Customerid-102's records.

Could you please provide a solution me to fix this issue.

Thanks in advance.

Regards,
Arunkumar M

推荐答案

这意味着您将数据绑定到ListView(WPF中没有ListBox)。因此,当选择更改时,窗口中的所有数据都会在所有窗口中自动更新。



为了最大限度地减少这种情况,您可以删除数据或Window本身的绑定。完成后,您可以继续创建一个动态窗口,其中只有与触发事件的ListViewItem相关的内容。这样,每个Window将只具有在创建时给出的数据。
This means that you're binding the data to the ListView (there is no ListBox in WPF). So when the selection changes all of the data in the Window is automatically updated in all of the windows.

To minimize this, you can remove the bindings of the data or the Window itself. Once done, you can then continue to create a dynamic window, with only the content related to the ListViewItem that triggered the event. This way, each Window will have just that data it was given at the create time.


这篇关于在WPF C#中的所有子窗口中打开相同的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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