views:

35

answers:

1

I would like to create a descendant of the Silverlight Navigation Framework's Page class, so I can perform common navigation code on all of my pages, but I can't figure out how to do this. When I create a descendant class, how do I reference that from my XAML files?

They currently have the "navigation:page" tag, so how do I replace that with "mypage" instead? Is there an annotation I need to add to my descendant?

Example:

I currently have the following:

<navigation:Page x:Class="Views.About" 
    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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="About" 
    Style="{StaticResource PageStyle}">
...
</navigation:Page>

Instead, I would like (given a class MyOwnPage : System.Windows.Controls.Page)

<MyOwnPage ...>
...
</MyOwnPage>
+1  A: 

I got it. Using the example above, you need to reference that subassembly in the opening tag, like so:

xmlns:views="clr-namespace:Views"

and then declare the root element as

<views:MyOwnPage ...>
...
</views:MyOwnPage>
Dov