English 中文(简体)
Wpf Selected 项目在《名单》中赢得了Combo盒的工作
原标题:Wpf SelectedItem wont work for a Combobox in a ListView

I´ve got a problem with a Combobox in a ListView. I´ve got a class called "Substrate". This class contains an object of a class called "SubstrateType". I want to show the objects of the class "Substrate" in a Listview. Each property of the "Substrate" is presented in the columns of the Listview. For the different "SubstrateType" I want to use a combobox.

在XAML中,我试图这样做:

<ComboBox Name="CBType"
          ItemsSource="{Binding ElementName=SettingsSubstrate, Path=TypeList}"
          SelectedItem="{Binding Path=Substrate.SubstrateType}"
          DisplayMemberPath="Description"/>

在密码后面,我有两个可观察的座谈会。 其中一个用于所有补贴,一个用于所有可能的补贴。 如你点击, com箱显示所有底栖。 但是,如果你打算选择一个子, com箱就没有选定项目。

http://i44.tinypic.com/2eakxav.png

提前感谢。

问题回答

我不知道你的准确代码,但如果您的名单上的浏览器显示的物体为<代码>Substrate,那么你为<代码>选择的斜线/代码>制定的具有约束力的途径应仅限<代码>SubstrateType,因为清单数据目录已经定在<编码>Substrate :物体上:

SelectedItem="{Binding Path=SubstrateType}"

此外,你需要确保您的<代码>SubstrateType实例实际上被视为平等。 如果<代码>SubstrateType,请见Substrate。 物体 实际上 与<代码>TypeList中的财产相同,将不予选择。 您可以通过超越<条码>(......)的方法确定这一方法,并确定您的习俗对平等进行比较。

如果不可行,请提供更多的代码,例如周围XAML和Substrate和编码背后/ViewModel/whatever。





相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

热门标签