Question

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>
Was it helpful?

Solution

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>

OTHER TIPS

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top