天天看點

Windows Phone 7 ManipulationStarted 事件

System.WindowsUIElement.ManipulationStarted 事件

當輸入裝置對 UIElement 對象開始操作時發生。

ManipulationStarted 事件在 ManipulationStarting 事件之後發生。 使用 ManipulationStartedEventArgs,您可以執行以下操作。

使用 ManipulationContainer 屬性擷取操作位置所相對的元素。

使用 ManipulationOrigin 屬性擷取操作的原點。

通過調用 Complete 方法來取消該操作。

小例子:點選界面,觸發事件 随機生成hello world

Windows Phone 7 ManipulationStarted 事件

<!--LayoutRoot contains the root grid where all other page content is placed-->

<Grid x:Name="LayoutRoot" Background="Transparent">

<Grid.RowDefinitions>

<RowDefinition Height="Auto"/>

<RowDefinition Height="*"/>

</Grid.RowDefinitions>

<!--TitlePanel contains the name of the application and page title-->

<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">

<TextBlock x:Name="ApplicationTitle" Text="UIElement對象操作開始觸發事件" Style="{StaticResource PhoneTextNormalStyle}"/>

<TextBlock x:Name="PageTitle" Text="main page" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

</StackPanel>

<!--ContentPanel - place additional content here-->

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

<TextBlock Name="txtblk"

Text=""

HorizontalAlignment="Center"

VerticalAlignment="Center" />

</Grid>

事件處理

繼續閱讀