0
votes

I'm building my first Silverlight application and I'm attempting to use a WrapPanel in one of my views. However I am getting the following error.

Error 1 The name "WrapPanel" does not exist in the namespace "http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit".

My code:

xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
...
<toolkit:WrapPanel Height="657" Width="657" />

Do I need to install a package or something? If so, how?

2
<toolkit:WrapPanel Height="657" Width="657" />Gabriel Asman
Did you add a reference to System.Windows.Controls.Toolkit?icebat

2 Answers

1
votes

Kindly refer to this link ::

WrapPanel

0
votes

Actually the WrapPanel control is not a part of Silverlight rather it is a part of Silverlight Toolkit. Before you can use a WrapPanel control, you must download the Silverlight Toolkit. After that you need to add a reference to an assembly. You will get Microsoft.Windows.Controls.dll assembly from the folder where you installed the Silverlight Toolkit. Now, you have to import the Microsoft.Windows.Controls namespace to the page. Once you type xmlns= in your page, you will see Microsoft.Windows.Controls listing in Intellisense.

<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
x:Class="Demo.App" 
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls">
    <Application.Resources>
            <!-- Resources scoped at the Application level should be defined here. -->
            <ItemsPanelTemplate x:Key="ExamplePanal">
                            <controls:WrapPanel/>
            </ItemsPanelTemplate>
    </Application.Resources>

The above example "xmlns:controls="clr-namespace:Microsoft.Windows.Controls" after adding this dll then the WrapPanel added to the Intellisense. while typing controls: intellisense show WrapPanal in the list. See the below code here I am adding ExamplePanal.

<Control
ItemsPanel="{StaticResource ExamplePanal}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" />

I think this may help you..

Thank You

Jom George