Interaction trigger for FilterDescriptors events

3 posts, 0 answers
  1. Vikas
    Vikas avatar
    36 posts
    Member since:
    Dec 2015

    Posted 12 Apr Link to this post

    I am using Interaction triggers to Data bind the Data filter event to Relay commands in view model, I can do this for FilterOperatorsLoading event that is directly in DataFilter but i need to listen to 2 other events that are in FilterDescriptors.

    This event works:

    <i:EventTrigger EventName="FilterOperatorsLoading">
                        <cmd:EventToCommand Command="{Binding FilterOperatorsLoadingCommand}" PassEventArgsToCommand="True" />
    </i:EventTrigger>

    How can do that same for RadDataFilter.FilterDescriptors.CollectionChanged and RadDataFilter.FilterDescriptors.ItemChanged event

    Thanks

    vikas mittal

  2. Martin Vatev
    Admin
    Martin Vatev avatar
    87 posts

    Posted 14 Apr Link to this post

    Hello Vikas,

     Thank you for contacting us.


    To achieve the desired behavior, you should set explicitly the SourceObject property of EventTrigger. Please take a look at the code snippet below and consider how this approach fits your scenario.

    <telerik:RadDataFilter x:Name="radDataFilter"
                       Source="{Binding Items, ElementName=clubsGrid}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="CollectionChanged" SourceObject="{Binding FilterDescriptors, ElementName=radDataFilter}">
                <cmd:EventToCommand Command="{Binding CollectionChangedCommand}" PassEventArgsToCommand="True" />
            </i:EventTrigger>
            <i:EventTrigger EventName="ItemChanged" SourceObject="{Binding FilterDescriptors, ElementName=radDataFilter}">
                <cmd:EventToCommand Command="{Binding ItemChangedCommand}" PassEventArgsToCommand="True" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </telerik:RadDataFilter>


    I hope that this helps. Should you have any other questions, do not hesitate to contact us.


    Regards,
    Martin Vatev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vikas
    Vikas avatar
    36 posts
    Member since:
    Dec 2015

    Posted 15 Apr in reply to Vikas Link to this post

    Thanks Martin, it works.

    Not sure why i dont see your answer here, I got the email. Posting the answer in case anybody else runs into this issue.

     

    <telerik:RadDataFilter x:Name="radDataFilter"
                       Source="{Binding Items, ElementName=clubsGrid}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="CollectionChanged" SourceObject="{Binding FilterDescriptors, ElementName=radDataFilter}">
                <cmd:EventToCommand Command="{Binding CollectionChangedCommand}" PassEventArgsToCommand="True" />
            </i:EventTrigger>
            <i:EventTrigger EventName="ItemChanged" SourceObject="{Binding FilterDescriptors, ElementName=radDataFilter}">
                <cmd:EventToCommand Command="{Binding ItemChangedCommand}" PassEventArgsToCommand="True" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </telerik:RadDataFilter>

Back to Top