Handling the Touch.FrameReported Event
The following example shows how to change the color of a Border
control by responding to the Touch.FrameReported
event. Within the TouchPointView
XAML file is a named Border
control as shown:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Border x:Name="border" Height="100" Width="200" Background="{StaticResource PhoneAccentBrush}" /></Grid>
The code-beside file, TouchPointView.xaml.cs, subscribes to the Touch.FrameReported
event within the page constructor. The event handler retrieves the primary touch point, and if the TouchPoint
is above the Border
, the Border
object’s Background
is switched (see Listing 12.2).
Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.