1

How to use PivotViewer in Silverlight xaml? I read http://msdn.microsoft.com/en-us/library/system.windows.controls.pivot.pivotviewer(v=vs.95).aspx and added a reference to the assembly.But I get an error

The name "PivotViewer" does not exist in the namespace "http://schemas.microsoft.com/client/2007".

This is my xaml:

<UserControl x:Class="SilverlightApplication2.MainPage"
    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"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="Hello world"></TextBlock>
        <PivotViewer/>
    </Grid>
</UserControl>
Wooble
  • 87,717
  • 12
  • 108
  • 131
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465

2 Answers2

2

Added a reference to the assembly System.Windows.Controls.Pivot then

<UserControl x:Class="SilverlightApplication2.MainPage"
    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"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:pivot="clr-namespace:System.Windows.Controls.Pivot;assembly=System.Windows.Controls.Pivot"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="Hello world"></TextBlock>
        <pivot:PivotViewer x:Name="pViewer"  />
    </Grid>
</UserControl>
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
1

I have a series on my blog that walks thru using the PivotViewer. That should get you started. http://tonychampion.net/blog/index.php/series/pivotviewer-basics/

  • Thanks Tony. I tried following your first tutorial but I get errors such as `PivotViewer is not supported in a Silverlight project` and `The namespace prefix "pivot" is not defined.` – Colonel Panic Mar 22 '13 at 09:47