[英]WP8: Button events triggering when navigating in panorama/pivot
我目前正在為WP8開發應用程序,並且在導航Panorama或Pivot-Views時出現問題。
例如:我有一個Panorama,它本身在每個頁面上都包含幾個按鈕。 如果我嘗試在這些頁面之間導航,我有時會不小心設法為某些按鈕引發Click事件。
在嘗試重現這個bug之后,我發現,這主要發生在我滑過一小段距離的時候。 如果我長距離滑動,則不會出現錯誤,也不會引發任何事件。
我正在使用Command Binding進行事件處理,我是否應該更改它? 我真的想弄清楚這一點,但是我仍然找不到除了服務之外的其他方法,如果發生滑動,它會禁用所有事件。
在此先感謝您的幫助,您可以給我!
PS:這是一些代碼,不知道它是否/如何幫助:
<phone:Panorama x:Name="Panorama" Title="{Binding LocalizationService.Resources.ApplicationTitle}">
<phone:PanoramaItem Header="{Binding LocalizationService.Resources.MainPage_Header}" HeaderTemplate="{StaticResource PanoramaItemHeaderTemplate}">
...
<Button Command="{Binding CmdNavigateToZipSearch}" Style="{StaticResource PizzaButtonAccentStyle}" Width="214" Height="172">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="/Assets/icon_plz-suche.png" Stretch="Uniform" Height="77" Margin="1,6,0,0" />
<TextBlock Grid.Row="1" Text="{Binding LocalizationService.Resources.MainPage_ZipSearch_Label}" Style="{StaticResource PizzaTextContrastStyle}" />
</Grid>
</Button>
...
在內部(AFAIK),按鈕上的命令基於單擊事件觸發。 而不是使用單擊/命令事件使用EventToCommand解決方案將命令綁定到Tap事件,因為由於它的移動閾值而無法在滑動的同時觸發。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.