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

DataFormComboBoxField

13 Answers 103 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 26 Mar 2012, 11:18 AM
How can i get the DataFormComboBoxField to select the top item in the list by default?

13 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 26 Mar 2012, 11:38 AM
Hello Andrew,

The recommended approach to achieve this with the current version of RadControls is to define a DataTemplate that  contains a RadComboBox, setting its SelectedIndex property to "0", like this:
<telerik:DataFormComboBoxField>
                    <telerik:DataFormComboBoxField.ContentTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox 
                                SelectedIndex="0" 
                             ...  />                      
                        </DataTemplate>
                    </telerik:DataFormComboBoxField.ContentTemplate>
                </telerik:DataFormComboBoxField>
However, as DataFormDataField is actually a ContentControl wrapper for RadComboBox, it won't be difficult to expose the SelectedIndex property for the field itself. I will implement this change for the next internal build of RadControls (next Monday/Tuesday). Until then you can utilize the proposed workaround.

Regards,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Andrew
Top achievements
Rank 1
answered on 26 Mar 2012, 03:39 PM
Thanks Ivan.

If I add the datatemplate to this how do i make sure all my bindings are working correctly.

Currently my code looks like this:

<telerik:DataFormComboBoxField DataMemberBinding="{Binding OwlRecordTypeId,Mode=TwoWay}" DisplayMemberPath="Name" SelectedValuePath="Id" ItemsSource="{Binding Source={StaticResource OWL_VM}, Path=OwlRecordTypes}" Label="Record Type:"/>

The two properties i am missing are DataMemberBinding and Label
0
Ivan Ivanov
Telerik team
answered on 26 Mar 2012, 03:53 PM
Hello Andrew,

The Label should be set only on the DataFormComboBoxField. DisplayValuePath, ItemsSource and SelectedValuePath should be the same as if they were set on the field. SelectedValue should be the same as DataMemberBinding. However, I would advise you to use this workaround only for development needs (until the IB), so that you could benefit from the new Selectedindex property. It might save you from writing additional code in some scenarios.

Regards,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Andrew
Top achievements
Rank 1
answered on 27 Mar 2012, 08:05 AM
Thanks. In that case i will wait.
0
Andrew
Top achievements
Rank 1
answered on 03 Apr 2012, 09:45 AM
Any news on this internal build?
0
Vlad
Telerik team
answered on 03 Apr 2012, 09:51 AM
Hello,

 The internal build is already released. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Andrew
Top achievements
Rank 1
answered on 03 Apr 2012, 10:08 AM
I see that this is not an build that installs automatically. 
How do i use this? Where do i need to copy the files?
0
Andrew
Top achievements
Rank 1
answered on 04 Apr 2012, 09:06 AM
Ivan,

I still don't know how to install this IB, also i had a look at the release notes and do not see any mention of exposing the SelectedIndex for DataFormComboBoxField , can you clarify if this release has this and if not when you expect it to come out.
0
Ivan Ivanov
Telerik team
answered on 04 Apr 2012, 09:39 AM
Hello Andrew,

The property was introduced with the internal build that was released on Monday  (v. 2012.1.0402).

Regards,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Andrew
Top achievements
Rank 1
answered on 04 Apr 2012, 09:58 AM
Ivan,

Can you please explain how to install the build?

Do i need to copy the files into the "RadControls for silverlight Q1 2012 SP1" folder?
Or do i need to keep the files somewhere else?
0
Vlad
Telerik team
answered on 04 Apr 2012, 10:01 AM
Hi,

 Have you missed our documentation

Kind regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Andrew
Top achievements
Rank 1
answered on 10 Apr 2012, 08:30 AM
Thanks Vlad, that works.

Is this going to be included into the next production worthy release?
If so when will this release be available?
0
Accepted
Vlad
Telerik team
answered on 10 Apr 2012, 08:40 AM
Hi,

 All internal builds are automatically included in our official releases. The next official release will be Q2 2012 (early June).

Kind regards,
Vlad
the Telerik team

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

Tags
DataForm
Asked by
Andrew
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Andrew
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or