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

DataFormComboBoxField event question

4 Answers 78 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Art Kedzierski
Top achievements
Rank 2
Art Kedzierski asked on 19 Aug 2013, 03:03 PM
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>

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 19 Aug 2013, 03:41 PM
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 >>
0
Art Kedzierski
Top achievements
Rank 2
answered on 19 Aug 2013, 04:04 PM
Is there an MVVM way to do that or just code-behind? 
0
Art Kedzierski
Top achievements
Rank 2
answered on 19 Aug 2013, 04:41 PM
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?
0
Maya
Telerik team
answered on 20 Aug 2013, 06:28 AM
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 >>
Tags
DataForm
Asked by
Art Kedzierski
Top achievements
Rank 2
Answers by
Maya
Telerik team
Art Kedzierski
Top achievements
Rank 2
Share this question
or