0
votes

I created a new project, Windows Phone 7.0

Since i wanted the DockPanel, i installed the Silverlight SDK from this link: http://silverlight.codeplex.com/ (November 2011 for Windows Phone)

I then added a reference from "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin\System.Windows.Controls.Toolkit.dll"

Then i tried to

1) Add the controls from the DLL into VS 2010 toolbox. But that did not work. I created a new tab and choose import, selected the DLL but when i pressed ok, the tab disappeared.

2) I then typed it into the Main file but this causes the following error: "Unknown namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit. [Line: 19 Position: 6]"

Here is the code in the mainpage.xaml file. Note that i have not added anything. Just removed the controls and added the dockpanel.

<phone:PhoneApplicationPage x:Class="TestProject.MainPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="768"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True">

    <toolkit:DockPanel>
        <TextBlock toolkit:DockPanel.Dock="Bottom"
                   Text="Copyright 2012"></TextBlock>
    </toolkit:DockPanel>
</phone:PhoneApplicationPage>

Any ideas why?

3

3 Answers

1
votes

In Addition to Hermit Dave 's answer: I wonder why you are developing an app for Windows Phone 7.0? Microsoft already stopped support for 7.0 apps. So check that once if you are not aware of it.

And I would suggest you to use [Nuget] package installer to install packages for you. Following steps help you on how to use Nuget.

1 . Add Nuget Extension to your Visual Studio 2010.

2 . Go through this link to learn how to use Nuget Package Manager Console

3 . Finally use the command in this link to install SilverlightToolkit

Then the code you shown above works like a magic. Happy coding :)

1
votes

First few lines say it all

Since i wanted the DockPanel, i installed the Silverlight SDK from this link: http://silverlight.codeplex.com/ (November 2011 for Windows Phone)

I then added a reference from "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin\System.Windows.Controls.Toolkit.dll"

you need to download and add a refernce to Silverlight light toolkit for Windows Phone. download the compiled assembly and add a reference to that.

right now you are trying to add reference to SL 4 assembly.

0
votes

See this article on how to use the DockPanel http://www.geekchamp.com/articles/using-dockpanel-in-wp7 and download the sample code from there (includes a library for DockPanel/WP7 that you could also upgrade to WP8 in Visual Studio 2013)

that article has a wrong example though shown, the correct example XAML is at a user comment there:

The sequence of buttons in source code affects the docking. This code block is OK

<panel:DockPanel>
    <Button  Content="Bottom" panel:DockPanel.Dock="Bottom"/>
    <Button  Content="Top" panel:DockPanel.Dock="Top"/>
    <Button  Content="Right"  panel:DockPanel.Dock="Right"/>
    <Button  Content="Left"  panel:DockPanel.Dock="Left"/>
    <Button  Content="Middle" />
</panel:DockPanel>