DataFormComboBoxField

14 posts, 1 answers
  1. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 26 Mar 2012 Link to this post

    How can i get the DataFormComboBoxField to select the top item in the list by default?

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 26 Mar 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 26 Mar 2012 Link to this post

    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
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 26 Mar 2012 Link to this post

    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 >>
  6. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 27 Mar 2012 Link to this post

    Thanks. In that case i will wait.
  7. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 03 Apr 2012 Link to this post

    Any news on this internal build?
  8. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 03 Apr 2012 Link to this post

    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 >>
  9. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 03 Apr 2012 Link to this post

    I see that this is not an build that installs automatically. 
    How do i use this? Where do i need to copy the files?
  10. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 04 Apr 2012 Link to this post

    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.
  11. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 04 Apr 2012 Link to this post

    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 >>
  12. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 04 Apr 2012 Link to this post

    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?
  13. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Apr 2012 Link to this post

    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 >>
  14. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 10 Apr 2012 Link to this post

    Thanks Vlad, that works.

    Is this going to be included into the next production worthy release?
    If so when will this release be available?
  15. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 10 Apr 2012 Link to this post

    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 >>

Back to Top
DevCraft banner