Wpf RadComboBox选择值时出错(RadComboItem)

Wpf RadComboBox选择值时出错(RadComboItem),wpf,web,telerik,radcombobox,Wpf,Web,Telerik,Radcombobox,它在WPF WEB中有一个RadComboBox,在运行时通过数据库调用填充。此数据集通过与以下类似的说明分配给combo: dim myNewItem as RadComboBoxItem myRadCombo.items.clear For each CurrentRow as DataRow in myDataset.tables(0).Rows myNewItem = new RadComboBoxItem With myNewITem . Content = "some text"

它在WPF WEB中有一个RadComboBox,在运行时通过数据库调用填充。此数据集通过与以下类似的说明分配给combo:

dim myNewItem as RadComboBoxItem
myRadCombo.items.clear
For each CurrentRow as DataRow in myDataset.tables(0).Rows

myNewItem = new RadComboBoxItem

With myNewITem
. Content = "some text"
. Tag = "some value"
. Foreground = New solidcolor (Colors.Some color)
End with

myRadCombo.Items.Add (myNewItem)

myNewItem = Nothing

Next
到目前为止,很好地完成了组合,并加载了查询产品的部署元素。。。。。但是,当选择组合中的项目时,应用程序会突然显示一个错误“对象引用未设置为对象的实例”

如果正确的话,我真的不理解这个错误的发生。。。。如何使用XML添加任何附加语句

一些XAML代码:

<telerik:RadToolBar IsEnabled="True" Name="myToolBar" Grid.Row="3">

                        <telerik:Label Content="Workstation Name:" />

                        <telerik:RadComboBox Name="WorkStationList" Width="100" IsReadOnly="True">
                            <telerik:RadComboBoxItem Content="Station 1" IsSelected="True" Tag="1" />
                            <telerik:RadComboBoxItem Content="Station 2" Tag="2"/>
                            <telerik:RadComboBoxItem Content="Station 3" Tag="3"/>
                            <telerik:RadComboBoxItem Content="Station 4" Tag="4"/>
                        </telerik:RadComboBox>
                    </telerik:RadToolBar>


如果您能发布更多代码,我将很乐意提供帮助。上面的代码段只说明了它最初是如何加载的,没有显示SelectionChanged事件处理代码或任何东西。另外,您不使用数据绑定方法填充组合还有什么原因吗?如果您使用WPF的方式与使用WinForms的方式相同,那么您就错过了机会。如果您愿意的话,WPF会使这些任务更加流畅。:)这是正确的狂热者…我觉得(而且我知道)我没有挖掘WPF桌面的潜力,我倾向于“削减”我对这项技术潜力的看法。然而,在这个案例中,程序控制没有发生任何事件,甚至连唤醒选择都没有改变。。。。所以我很好奇为什么会发生这种错误。