This is a migrated thread and some comments may be shown as answers.
ComboBox for other than enum
6 Answers 176 Views
This is a migrated thread and some comments may be shown as answers.
roger
Top achievements
Rank 1
roger asked on 17 Jul 2011, 10:31 PM

I'm trying to load a collection (which is an attribute of an object) into a RadComboBox (instead of just having the id / ToString inside a textbox).

I got this working so far with a datatemplate which I apply inside the AutoGeneratingPropertyDefinition Handler.

 

DataTemplate dt = (DataTemplate)this.FindResource("TemplateComboBoxTemplate");                 
e.PropertyDefinition.EditorTemplate = dt;

The template looks like the following:
<DataTemplate x:Key="TemplateComboBoxTemplate">     
    <
telerik:RadComboBox ItemsSource="{Binding Source={StaticResource TemplateComboBoxSource}, Path=Templates}"
                        Margin="0">
        <telerik:RadComboBox.ItemTemplate>
            <DataTemplate>           
                <TextBlock Text="{Binding Title}" />         
            </DataTemplate>       
        </telerik:RadComboBox.ItemTemplate>     
    </telerik:RadComboBox>   
</DataTemplate>

As I said, the above works great, except that I have no idea how to set up a two way binding
so that the RadComboBox actually reflects the property.

6 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 18 Jul 2011, 08:14 AM
Hi Roger,

You may define the DataTemplate as follows:

<DataTemplate x:Key="TemplateComboBoxTemplate">
            <telerik:RadComboBox ItemsSource="{Binding Clubs, Source={StaticResource MyViewModel}}"
                                 SelectedValue="{Binding ClubID}"
                                 SelectedValuePath="ID"
                                 DisplayMemberPath="Name"
                                 Margin="0">
            </telerik:RadComboBox>
        </DataTemplate>

On other hand, you may create directly a LookupPropertyDefinition. I am sending you a sample project illustrating both approaches.
Let me know in case you need any further assistance.
  Best wishes,
Maya
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
roger
Top achievements
Rank 1
answered on 18 Jul 2011, 10:41 PM
Of course, thank you!
0
Craig
Top achievements
Rank 1
answered on 12 Oct 2012, 02:40 PM
Hi
I hope it's not too late to get a reply to this thread.
I'm getting to grips with the OpenAccess ORM, WPF Sofia Car Rental WCF Plain Services sample in OpenAccess 2012_2_816.
I've built a solution based on this sample using my OpenAccess model.
I've got a view with a RadPropertyGrid which displays an object successfully. I've also got an independent RadComboBox that displays a collection of reference data successfully. 
One of the properties in the RadPropertyGrid is a reference id to an object in the collection displayed in the combobox.
I've tried to use the LookupPropertyDefinition in the XAML, as shown in the sample you attached but I get binding errors which I'm unable to resolve.

Is there a sample like the Sofia Car Rental sample that uses LookupPropertyDefinition?

TIA 
Craig
0
Craig
Top achievements
Rank 1
answered on 19 Oct 2012, 10:17 AM
0
Dharmavaram
Top achievements
Rank 1
answered on 29 Sep 2016, 11:30 AM

Hi,

I have similar requirement.could you please share the sample project in WPf.I am unable to open that silverlight Project and run.

 

Regards,

Nagasree.

0
Stefan
Telerik team
answered on 04 Oct 2016, 07:41 AM
Hello Nagasree,

On my end the sample application provided by my colleague runs as expected. However, I prepared the same demo in WPF for your convenience.

I hope it helps.

Regards,
Stefan X1
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Asked by
roger
Top achievements
Rank 1
Answers by
Maya
Telerik team
roger
Top achievements
Rank 1
Craig
Top achievements
Rank 1
Dharmavaram
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or