我将数据库表的主键绑定到组合框的selectedIndex。问题发生在主键从1开始,但selectedIndex从0开始接受。我的意思是,当我想在数据库中看到ID = 1的项目时,因为它被列为索引为0的组合框中的第一个元素,它显示第二个元素在组合框中被认为ID = 1的列表中。任何人都可以帮助我解决这个问题吗?Combobox中的数据绑定
在此先感谢。 这里是我的组合框:
<ComboBox SelectedIndex="{Binding SC.User1.UserID, UpdateSourceTrigger=PropertyChanged }"
IsSynchronizedWithCurrentItem="True"
x:Name="proxyResponsibleUserCmb" ItemsSource="{Binding Users, Mode=OneTime}"
SelectedItem="{Binding SC.User1.FullName, ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}"
Validation.ErrorTemplate="{x:Null}"
Height="23"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Width="118"
Margin="184,3,0,0"
Grid.Row="0"
Grid.Column="1"/>
你能提供一些代码吗?例如。如果您的selectedIndex是一个属性,为什么不在那里进行计算? – 2010-08-26 07:18:37