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

Interaction trigger for FilterDescriptors events

2 Answers 382 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 12 Apr 2016, 06:09 PM

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 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 15 Apr 2016, 06:41 AM
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.
0
Vikas
Top achievements
Rank 1
answered on 15 Apr 2016, 02:32 PM

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>

Tags
DataFilter
Asked by
Vikas
Top achievements
Rank 1
Answers by
Martin
Telerik team
Vikas
Top achievements
Rank 1
Share this question
or