Example: Drag and Drop

This section is based on a video, Writing Your First Rx Application, posted by the Rx Team,2 one we very much like because it treats your mouse as an observable collection of locations. You can then subscribe to that collection and as new locations (points) become available, you will be notified.

To get started, let's create a new Windows Phone application. Replace the grid with a canvas, and add a TextBlock and an image, as shown in the following code:

<Canvas>    <TextBlock       Name="textBlock"       Text="Rx for Silverlight" />    <Image       Name="image"       Source="avatar.png"       Width="191"       Height="206"       Canvas.Left="12"       Canvas.Top="50" /> </Canvas>

Note that you will need to download

Get Programming Reactive Extensions and LINQ 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.