Supported TriggerAction events in 4.1

Supported TriggerAction events in 4.1

Old forum URL:

TSF posted on Friday, November 18, 2011

Are there only certain types of events that the TriggerAction control supports?  When I hook up something like a Button, the click event works fine and fires the method that I specify.  But I'm trying to use other events, like a MouseLeftButtonDown or MouseEnter event for a Grid, and the method I specify never gets fired.

RockfordLhotka replied on Friday, November 18, 2011

It should work with any event. I use it for mouse events quite frequently, so I'm pretty confident that it handles those just fine.

TSF replied on Friday, November 18, 2011

Then I'm probably doing something wrong.  Here's what I'm trying to do.  I've got a SL4 datagrid, and I want to capture when a user sorts by clicking on a column.  Because I wasn't getting anywhere with a click event, I switched to a MouseEnter event just for testing.  I've tried many variations, from having my TriggerAction reference the name of the grid in the control template in the style resource, to referencing a grid embedded directly in the column's header style (which is shown below).

[EDIT:  oops - I highlighted and was referring to the Grid named TestGrid (below), but my code was really rerencing the TextBlock named "ColumnHeaderAvailableTime."  I've corrected the highlighting below.  But the point is I've tried using a couple different elements to get it to work.]

      <sdk:DataGridTemplateColumn Width="Auto" SortMemberPath="AvailableTime">
        <Style TargetType="sdk:DataGridColumnHeader" BasedOn="{StaticResource DataGridColumnHeaderStyleDashboard}">
         <Setter Property="ContentTemplate">
                     <Grid Name="TestGrid">
                         <TextBlock Name="ColumnHeaderAvailableTime">Available Time *</TextBlock>

Then, after the grid, I have the following, where the ColumnHeaderClick method is in the VM referenced by the agentMonitorVmViewSource resource.

                <bxf:TriggerAction TargetControl="{Binding ElementName=ColumnHeaderAvailableTime}"
              DataContext="{Binding Source={StaticResource agentMonitorVmViewSource}}"
                 MethodParameter="AvailableTime" />

And finally, here is the method in the VM:

public void ColumnHeaderClick(object sender, Bxf.Xaml.ExecuteEventArgs e){...}


Copyright (c) Marimer LLC