EventToCommand Not working Inside DataTemplate

2 posts, 0 answers
  1. Shanmuga
    Shanmuga avatar
    15 posts
    Member since:
    Mar 2015

    Posted 23 Oct 2015 Link to this post


    EventToCommand is not working  inside DataTemplate

    In my code <commands:EventToCommand Command="{Binding Path=CellSelectionChangedCommand}" ></commands:EventToCommand> is not fired.

    <telerik:GridViewDataColumn Header="Node Name" Width="200" ColumnGroupName="BasicInformation" x:Name="test">
    <telerik:RadComboBox SelectedValue="{Binding CellId}" x:Name="cbxCells1" SelectionChanged="cbxCells1_SelectionChanged"
    SelectedItem="{Binding Path=SelectedCell,Mode=TwoWay}"
    ItemsSource="{Binding Path=Cells, Source={StaticResource lcgroupconfigurationModel}}"
    ItemTemplate="{StaticResource ProjectDataTemplate}"
    Command="{Binding CellSelectionChangedCommand, Source={StaticResource lcgroupconfigurationModel}}">
    <i:EventTrigger EventName="SelectionChanged">
    <commands:EventToCommand Command="{Binding Path=CellSelectionChangedCommand}" ></commands:EventToCommand>
    <i:EventTrigger EventName="DropDownOpened">
    <commands:EventToCommand Command="{Binding Path=DropDownOpenedCommand}" ></commands:EventToCommand>


    Please Help Me



  2. Ivan Ivanov
    Ivan Ivanov avatar
    1201 posts

    Posted 28 Oct 2015 Link to this post


    This is known framework limitation of SIlverlight. When a DataTemplate that defines any triggers is used to create content by invoking DataTemplate.LoadContent, the elements in the generated visual subtree lose the trigger logic. A possible MVVM-friendly workaround that you can use is to wrap the logic in an attached behavior that internally handles the event. Would this approach be acceptable to you?

    Ivan Ivanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top