C# 按钮上未触发操纵完成事件

C# 按钮上未触发操纵完成事件,c#,windows-phone-8.1,C#,Windows Phone 8.1,在我的Windows Phone 8.1通用应用程序中,我有一个列表视图,在项目模板中有一个按钮,我需要查看该按钮的操作开始和操作完成事件何时触发。当前manufactionstarted工作正常,但manufactioncompleted不工作。有人能解释一下原因吗 SnapsPage.xaml <Grid Grid.Row="0" Background="#88686868"> <Grid.RowDefinitions> <RowDefi

在我的Windows Phone 8.1通用应用程序中,我有一个
列表视图
,在
项目模板
中有一个按钮,我需要查看该按钮的
操作开始
操作完成
事件何时触发。当前
manufactionstarted
工作正常,但
manufactioncompleted
不工作。有人能解释一下原因吗

SnapsPage.xaml

<Grid Grid.Row="0" Background="#88686868">
    <Grid.RowDefinitions>
        <RowDefinition Height="130" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <StackPanel Grid.Row="0" Orientation="Vertical" Margin="20,0,0,0">
        <TextBlock Text="{Binding Path=Manager.Account.Username, FallbackValue='loading...'}" Margin="0,12,0,0" Style="{ThemeResource HeaderTextBlockStyle}"/>
        <TextBlock x:Uid="Snaps" Text="SNAPS" Style="{ThemeResource TitleTextBlockStyle}" Typography.Capitals="SmallCaps"/>
    </StackPanel>

    <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto"  HorizontalScrollBarVisibility="Disabled" 
                  Padding="0,0,0,20" Grid.Row="1" HorizontalContentAlignment="Stretch">
        <ListView HorizontalContentAlignment="Stretch" 
                  ItemsSource="{Binding Path=Manager.Account.Snaps}">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Button x:Name="ButtonSnap" Style="{StaticResource BasicEmptyButtonStyle}"
                            ManipulationStarting="ButtonSnap_OnManipulationStarting"
                            ManipulationCompleted="ButtonSnap_OnManipulationCompleted"
                            ManipulationMode="All"
                            Command="{Binding ElementName=ItemsControl, Path=DataContext.TryDownloadMediaCommand}" 
                            CommandParameter="{Binding}">

                        <!-- Content Here -->

                    </Button>
                </DataTemplate>
            </ListView.ItemTemplate>
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel HorizontalAlignment="Stretch"></VirtualizingStackPanel>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </ListView>
    </ScrollViewer>
</Grid>

<Grid Grid.Row="0" x:Name="MediaGrid" Background="#FF000000" IsHitTestVisible="False">
    <Image x:Name="MediaImage" IsHitTestVisible="False"/>

    <Grid Width="45" Height="45" Background="#99000000"
          VerticalAlignment="Top" HorizontalAlignment="Right" Margin="25">
        <TextBlock Text="10" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="Segoe WP Semibold" FontSize="24" />
    </Grid>
</Grid>

注意:我使用Windows Phone 8.1 XAML应用程序(不是Silverlight)进行了测试

该按钮具有系统的操纵模式,根据,这意味着您不应获取操纵事件

元素必须具有除None或System之外的OperationMode值才能作为操纵事件源


我会尝试一下,稍后再汇报。(也不使用Silverlight)
    private void ButtonSnap_OnManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
    {
        Debug.WriteLine("ButtonSnap_OnManipulationStarting");
        var button = sender as Button;
        if (button == null) return;
        var snap = button.DataContext as Snap;
        if (snap == null) return;
        _relevantSnap = snap;

        _isFingerDown = true;
        _scrollYIndex = ScrollViewer.VerticalOffset;
        _holdingTimer.Start();
    }

    private void ButtonSnap_OnManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
    {
        Debug.WriteLine("ButtonSnap_OnManipulationCompleted");
        _isFingerDown = false;

        if (_isMediaOpen)
            DisposeMediaTidily();
    }