DataFormComboBoxField event question

5 posts, 0 answers
  1. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 19 Aug 2013 Link to this post

    Does the DataFormComboBoxField support the SelectionChanged event? I'm trying to change a related DataFormComboBoxField (actually, a four-tier hierarchical tree) and it's not working as expected. I'm using MVVM.

    <telerik:DataFormComboBoxField Label="Vendor (Required):"
                                   DataMemberBinding="{Binding Vendor, Mode=TwoWay}"
                                   ItemsSource="{Binding ElementName=LayoutRoot, Path=DataContext.Vendors}"
                                   SelectedValuePath="Vendor"
                                   DisplayMemberPath="Vendor">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="SelectionChanged">
                <ei:CallMethodAction TargetObject="{Binding}"
                                     MethodName="GetProducts"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </telerik:DataFormComboBoxField>
    <telerik:DataFormComboBoxField Label="Product (Required):"
                                   DataMemberBinding="{Binding Product, Mode=TwoWay}"
                                   ItemsSource="{Binding ElementName=LayoutRoot, Path=DataContext.Products}"
                                   SelectedValuePath="Product"
                                   DisplayMemberPath="Product"
                                   IsEnabled="{Binding ElementName=LayoutRoot, Path=DataContext.ProductsEnabled}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="SelectionChanged">
                <ei:CallMethodAction TargetObject="{Binding}"
                                     MethodName="GetComponents"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </telerik:DataFormComboBoxField>
    <telerik:DataFormComboBoxField Label="Component:"
                                   DataMemberBinding="{Binding Component, Mode=TwoWay}"
                                   ItemsSource="{Binding ElementName=LayoutRoot, Path=DataContext.Components}"
                                   SelectedValuePath="Component"
                                   DisplayMemberPath="Component"
                                   IsEnabled="{Binding ElementName=LayoutRoot, Path=DataContext.ComponentsEnabled}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="SelectionChanged">
                <ei:CallMethodAction TargetObject="{Binding}"
                                     MethodName="GetVersions"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </telerik:DataFormComboBoxField>
    <telerik:DataFormComboBoxField Label="Version:"
                                   DataMemberBinding="{Binding Version, Mode=TwoWay}"
                                   ItemsSource="{Binding ElementName=LayoutRoot, Path=DataContext.Versions}"
                                   SelectedValuePath="Version"
                                   DisplayMemberPath="Version"
                                   IsEnabled="{Binding ElementName=LayoutRoot, Path=DataContext.VersionsEnabled}">
    </telerik:DataFormComboBoxField>

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Aug 2013 Link to this post

    Hello Art,

    You can add handler for RadComboBox SelectionChanged event as illustrated in this article

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 19 Aug 2013 Link to this post

    Is there an MVVM way to do that or just code-behind? 
  5. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 19 Aug 2013 Link to this post

    Also, that article is for a GridViewComboBoxColumn. Is the process the same for DataFormComboBoxField? Do I need to add a separate handler for each DataFormComboBoxField?
  6. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 20 Aug 2013 Link to this post

    Hi Art,

    The same approach as the one illustrated in the article can be applied for data form and you need to add the handler only once. The event will be fired for selection change of each DataFormComboBoxField.
    If you do not want to implement that logic in your code-behind, you can try creating an attached behavior and place it there. 

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner