1
我在Windows Phone 8應用程序中使用了一串矩形形狀,我需要支持多點觸控,因此可以一次點擊其中的一些。我沒有做任何額外的處理,因爲我認爲Windows Phone 8應用程序默認支持多點觸控。Windows Phone 8上的多點觸控按鈕
一切都用C#和XAML編寫。當我試圖同時按兩個矩形時,敲擊事件不會被任何一個敲擊。
謝謝你對此的任何想法。
瓷磚的XAML:
所有三個<Rectangle x:Name="tile11" HorizontalAlignment="Left" Height="103" Margin="10,22,0,0" VerticalAlignment="Top" Width="103" Tap="TileClickHandler" Hold="TileHoldHandler" MouseLeftButtonDown="tile11_MouseLeftButtonDown" MouseLeftButtonUp="tile11_MouseLeftButtonUp">
<Rectangle.Fill>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Tiles/DEFAULT.png"/>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name="tile12" HorizontalAlignment="Left" Height="103" Margin="120,22,0,0" VerticalAlignment="Top" Width="103" Tap="TileClickHandler" Hold="TileHoldHandler" MouseLeftButtonDown="tile11_MouseLeftButtonDown" MouseLeftButtonUp="tile11_MouseLeftButtonUp">
<Rectangle.Fill>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Tiles/DEFAULT.png"/>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name="tile14" HorizontalAlignment="Left" Height="103" Margin="340,22,0,0" VerticalAlignment="Top" Width="103" Tap="TileClickHandler" Hold="TileHoldHandler" MouseLeftButtonDown="tile11_MouseLeftButtonDown" MouseLeftButtonUp="tile11_MouseLeftButtonUp">
<Rectangle.Fill>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Tiles/DEFAULT.png"/>
</Rectangle.Fill>
</Rectangle>
一個自來水處理:
private void TileClickHandler(object sender, System.Windows.Input.GestureEventArgs e)
{
if (IsRecordingActive)
{
StopRecording();
IsRecordingActive = false;
ManageTileState(ActiveRecordingTile, Constants.TileStates.HAS_SOUND);
}
else
{
System.Windows.Shapes.Rectangle tile = (System.Windows.Shapes.Rectangle)sender;
if (DoesTileHaveSound(tile))
{
Thread soundThread = new Thread(new ParameterizedThreadStart(PlaySound));
soundThread.Start(tile.Name);
}
}
}
沒有你的代碼,很難確定。您是否閱讀過有關處理多點觸控的文檔和示例? http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207076(v=vs.105).aspx – WiredPrairie
嘿,我用代碼更新了問題。 –
從我鏈接到的文檔中:「在Windows Phone應用程序中啓用觸摸輸入的最簡單方法是使用鼠標事件。鼠標事件僅限於單指手勢,例如點擊和雙擊,並且它們不支持速度基於手勢。「 – WiredPrairie