问题描述
我对C#WPF很新,所以请耐心等待我的问题。我有两个列表框(listbox1和listbox2),其中listbox1中的项目将在运行时通过用户输入添加或删除。我希望listbox2通过绑定方法相应地显示其listboxitem。
例如,如果listbox1最初有5个项目,我希望listbox2显示相同的5个项目。如果在运行时添加或删除listbox1中的项目,我希望listbox2显示与listbox1相同的数据(项目)。
有人可以给我一个提示吗?在此先感谢。
I am pretty new to C# WPF, so please bear with my question. I have two listboxes (listbox1 and listbox2) where the items in listbox1 will be added or removed during runtime through user input. I want the listbox2 to display its listboxitem accordingly through binding method.
For example, if listbox1 has 5 items initially, i want the listbox2 to display the same 5 items. If items in listbox1 being added or removed in runtime, I want the listbox2 to display the same data (items) as listbox1.
Can someone give me a tip? Thanks in advance.
这篇关于将一个列表框listboxitem与另一个列表框绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!