Search code examples
windows-phone-7silverlight-toolkit

Howto use the Silverlight Toolkit


I'm trying to implement a Drag and Drop interface for my windows phone application. I'm following this tutorial. I have downloaded and installed the Silverlight toolkit from their site. Also I have added a reference to it.

I get the following error when I try to compile my code.

Error   1   'toolkit' is an undeclared prefix. Line 33, position 14.    C:\Users\USER\Documents\Visual Studio 2010\Projects\DragEventDemo\DragEventDemo\MainPage.xaml   33  14  DragEventDemo

This is the code I have in the content grid in my MainPage.xaml

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
    <Rectangle Width="100" Height="100" Fill="Red">
        <toolkit:GestureService.GestureListener>
            <toolkit:GestureListener DragDelta="OnDragDelta"
        GestureBegin="OnGestureBegin" GestureCompleted="OnGestureCompleted" />
        </toolkit:GestureService.GestureListener>
        <Rectangle.RenderTransform>
            <TranslateTransform />
        </Rectangle.RenderTransform>
    </Rectangle>
</Grid>

What am I missing out on?


Solution

  • Have you got a prefix declaration within your PhoneApplicationPage tag?

        <phone:PhoneApplicationPage 
            (...)
            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
            (...) 
        >