views:

15

answers:

0

Hi, i have problem with control template of infragistics xamdatagid in using with blend interaction triggers. Template is adding delete button style and edit button style for each row of xamdatagrid. When i am trying to set interaction trigger on event (MouseLeftButtonDown) and bind it to my command property in corresponding ViewModel, simply nothing happens. Event is not firing. It is like blend interaction trigger is unable to catch that event.

<UserControl x:Class="natbase.View.AllCustomersView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:natbase.ViewModel"
         mc:Ignorable="d"
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
         xmlns:igDP="http://infragistics.com/DataPresenter"
         xmlns:igEditors="http://infragistics.com/Editors"
         d:DesignHeight="600" d:DesignWidth="976">


<!-- USERCONTROL RESOURCES-->
<UserControl.Resources>
    <!-- DELETE BUTTON STYLE-->
    <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="deleteButtonStyle">
        <Setter Property="Visibility" Value="Collapsed"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Image Source="/natbase;component/Images/cancel_48.png" HorizontalAlignment="Center"
                                   Width="20" Height="20">
                                    <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonDown">
                                            <local:CommandAction Command="{Binding DeleteCommand}"
                                                                     SyncOwnerIsEnabled="True"/>
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                    </Image>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                <Setter Property="Visibility" Value="Visible"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=IsActive}" Value="True">
                <Setter Property="Visibility" Value="Visible"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsMouseOver, 
                RelativeSource={RelativeSource FindAncestor, 
                AncestorType={x:Type igDP:DataRecordPresenter}}}" Value="True">
                <Setter Property="Visibility" Value="Visible"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

When i try to fire simple event in xaml on image mouse left click and setting handler in code behind code, it working fine. Like this.

                 <ControlTemplate>
                    <Image Source="/natbase;component/Images/delete_48.png" HorizontalAlignment="Center"
                                   Width="20" Height="20"
                                   MouseLeftButtonDown="Image_MouseLeftButtonDown"/>
                </ControlTemplate>

But it is not the point. I need to fire the event and consume it in my VIEWMODEL. Pls can anybody help me, or have any idea? Thank you.