0

It has a RadComboBox in WPF WEB, which is filled at runtime through a database call. This data set is assigned to combo through instructions similar to the following:

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

So far so good, the combo is filled smoothly, and deployed elements of the query product loaded ..... however when an item in the combo is selected, the application displays an error abruptly "Object reference not set to an instance of an object ".

I really do not understand the occurrence of this error if correct .... how is it necessary any additional statement with the XML?

Some XAML code:

<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>
xavendano
  • 133
  • 5
  • 14
  • If you can post more code, I will gladly try to help. The above snippet only indicated how it is initially loaded, and shows no SelectionChanged event handling code or anything. – XamlZealot Nov 23 '12 at 22:02
  • Also, is there a reason you are not using DataBinding approach to populating the Combo? If you are using WPF in the same way you used WinForms, then you are missing the boat. WPF makes such tasks much more fluid, if you let it. :) – XamlZealot Nov 23 '12 at 22:04
  • That is correct Zealot....I feel (and I know) I'm not exploiting the potential of my roots in WPF Desktop and tend to "cut" my vision of the potential of this technology. However, taking up the case, there is no event for program control, not even awake selection_changed indeed .... So my curiosity about why the error occurs. – xavendano Nov 26 '12 at 15:06

0 Answers0