gpt4 book ai didi

c# - Windows Phone 8.1 操作事件不触发

转载 作者:行者123 更新时间:2023-12-02 11:12:31 24 4
gpt4 key购买 nike

我尝试在 ListView 上使用 Windows Phone 8.1 上的操作事件,但没有任何操作事件触发。指针事件触发,但它们以一种非常奇怪的方式工作,我需要操纵事件。即使我尝试在父元素上触发事件,也不会触发任何事件。我找到了Youtube Video这满足了我的需要,但它不适用于 Windows Phone 8.1。还有这个Link有人似乎遇到了同样的问题,有人说他们添加了事件就好了(尽管没有代码片段)。我尝试将事件添加到父元素,但没有触发任何事件,我尝试获取 ListView 的 ScrollViewer 并将事件添加到其中,但没有触发任何事件,我什至尝试将 ListView 更改为 ListBox,但仍然没有触发任何事件。任何帮助将不胜感激。

    public MainPage()
{
this.InitializeComponent();

this.NavigationCacheMode = NavigationCacheMode.Required;
ItemLV.DataContext = Items.DealsCollection;

ItemLV.ManipulationStarted += ItemLV_ManipulationStarted;
}

private void ItemLV_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
{
throw new NotImplementedException();
}


<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Pivot Grid.Row="1" x:Name="Pivot">
<PivotItem Margin="0,-5,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="frontpage" Foreground="#0072bc" FontSize="30" Margin="5,0,0,0"/>
<ListView x:Name="ItemLV" IsItemClickEnabled="True" Grid.Row="1" ItemsSource="{Binding}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<Grid x:Name="ItemGrid" Margin="0,2,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="{Binding ImgUrl}" Stretch="Uniform" Canvas.ZIndex="2" Margin="5,5,5,2" VerticalAlignment="Center"/>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Title}"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="18" TextWrapping="Wrap" Foreground="Black"/>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock Text="{Binding Price}"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="20" TextWrapping="Wrap" Foreground="#0075DB"/>
<Image Source="Assets/flame.gif" Visibility="{Binding Firedeal, Converter={StaticResource ImageBoolConverter}}" VerticalAlignment="Center" Margin="5,3,0,0"/>
</StackPanel>
<TextBlock Text="{Binding ExtraInfo}" Grid.Row="2"
VerticalAlignment="Center" HorizontalAlignment="Left"
FontSize="16" TextWrapping="Wrap" Foreground="#569B1A"
Visibility="{Binding ExtraInfo, Converter={StaticResource LengthConverter}}">
</TextBlock>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Store}"
VerticalAlignment="Bottom" HorizontalAlignment="Left"
FontSize="16" TextWrapping="Wrap" Foreground="#666"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1">
<TextBlock Text="{Binding Rating}" VerticalAlignment="Bottom"
FontSize="16" TextWrapping="Wrap" Foreground="Black"/>
<Image Source="Assets/tup.png" VerticalAlignment="Bottom" Margin="2,0,5,0" />
<TextBlock Text="{Binding Comments}" VerticalAlignment="Bottom"
FontSize="16" TextWrapping="Wrap" Foreground="Black"/>
<Image Source="Assets/comment.png" VerticalAlignment="Bottom" Margin="0,4,3,0" />
</StackPanel>
</Grid>
</Grid>
<Border BorderThickness="0,2,0,0" BorderBrush="#0072bc" Grid.ColumnSpan="2"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</PivotItem>
</Pivot>
</Grid>

最佳答案

您不会收到操作事件,因为 ListView 的 ManipulationMode设置为系统。根据the docs :

An element must have a ManipulationMode value other than None or System to be a manipulation event source.

我不建议更改模式,因为它很可能会停止滚动。

关于c# - Windows Phone 8.1 操作事件不触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24623994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com