This is a migrated thread and some comments may be shown as answers.

Issue binding RadComboBox

5 Answers 165 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adam
Top achievements
Rank 2
Adam asked on 10 May 2012, 02:29 PM
Hi all,

I'm working with the RadComboBox that I've placed inside my RadGridView Data Column Header. I've tried all types of ways to bind this combo box without success. I'm wanting to bind from code behind and I'd like to bind to a list. My list if populated using WCF.

When my list is populated with the WCF results I then try to set the combo box item source to my list but that's giving me the object reference not set to an instance.....error....

Can you provide some code samples?

Here is what I've tried so far:
XAML for RadComboBox inside Header
<telerik:GridViewDataColumn Width=".10*" Background="#6DFFFFFF">
     <telerik:GridViewDataColumn.Header>
           <telerik:RadComboBox x:Name="cboType" ItemTemplate="{StaticResource dropDownTemplate }">
            </telerik:RadComboBox>
      </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>

C# (Just bare code to show you the data return and binding)
void client_GetRotarySystemsCompleted(object sender, GetRotarySystemsCompletedEventArgs e)
        {
            try
            {
                if (e.Cancelled == false && e.Error == null && e.Result != null)
                {
                    DATASystem = e.Result;
                }
            }
            finally
            {
                AppBusy.SetNotBusy();
            }
            LoadCombo();
        }

        public void LoadCombo()
        {
            cboType.ItemsSource = from af in DATASystem
                                  select af.CAB;
        }       

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 15 May 2012, 02:57 PM
Hi Adam,

Please find attached an example which demonstrates how you can populate the combobox in this case. Download it and give it a try.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 2
answered on 15 May 2012, 09:27 PM
Thanks Yana,
This works, however, can you show me an example where the RadComboBox itemsource is the return value from a WCF web service? Keep in mind, I want the RadComboBox inside the RadGridView column header.

Thanks!
Adam
0
Accepted
Yana
Telerik team
answered on 16 May 2012, 09:22 AM
Hello Adam,

The example I've sent uses Silverlight-enabled WCF service, please check the Web project - it is called SampleService.svc.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 2
answered on 16 May 2012, 01:49 PM
Oops, You're correct. I'm sorry about that. Last question: I notice the class you use as the user control resource is in the same file as the user control, MainPage.XAML.

I've tried to replicate what you're doing by adding a new class inside my user control but I'm not sure how I can add it as a resource as I'm getting an error stating that 'CLR URI refers to namespace that is not included in the assembly'. How are you not getting that same type of error?

If I want the class inside the user control where the grid and drop-down list are located, how do I add that as a resource in the XAML so I can set the drop-down list item source?

I hope I'm making sense here, I'm unclear as to how you're able to create a resource from the class that's inside your user control and I'm not.

Thanks,
Adam
0
Adam
Top achievements
Rank 2
answered on 16 May 2012, 02:52 PM
I got it Yana. Thanks for all your help!

Adam
Tags
ComboBox
Asked by
Adam
Top achievements
Rank 2
Answers by
Yana
Telerik team
Adam
Top achievements
Rank 2
Share this question
or