Skip to main content

Microsoft Silverlight

Answered Question beta1->beta2 problem - XAML base classRSS Feed

(0)

chadbr
chadbr

Member

Member

53 points

27 Posts

beta1->beta2 problem - XAML base class

 

Hey Everyone,

 

I'm trying to upgrade my B1 project to B2 --

 

In B1, I had defined a base class for my XAML classes --

 

namespace MyApp.Screens

{

    public class FormBase : UserControl

    {

        public FormBase ()

        {

        }

    }

}

 

 

And my XAML / XAML.cs files declared like so:

 

-------------

namespace MyApp.Screens

{

    public partial class Test : FormBase

    {

        public Test()

        {

            InitializeComponent();

        }

….

----------------

 

<FormBase x:Class="MyApp.Screens.Test"

    xmlns="http://schemas.microsoft.com/client/2007"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

    xmlns:extSL="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended"

               >

 

    <Grid x:Name="LayoutRoot" Background="Transparent">

        <Grid.RowDefinitions>

 

….

 

 

 

In beta 2, I always get this error when I try to instantiate my control from code:

 

Test test = new Test();

 

Exception:

 

XamlParseException - Unknown element: FormBase [Line: 6 Position: 16]

 

 

The base class has no code (just a public ctor) or XAML.

 

Can anyone give me a clue here… ?

 

Thanks --

Leonid Andruhin
Leonid A...

Member

Member

636 points

137 Posts

Answered Question

Re: beta1-&gt;beta2 problem - XAML base class

Modify your xaml:

<screens:FormBase x:Class="MyApp.Screens.Test"

    xmlns="http://schemas.microsoft.com/client/2007"

    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

    xmlns:screens="clr-namespace:MyApp.Screens"

    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

    xmlns:extSL="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended"

               >

 

    <Grid x:Name="LayoutRoot" Background="Transparent">

        <Grid.RowDefinitions>

 

don't forget to modify closing tags. If not works - specify assembly for

    xmlns:screens="clr-namespace:MyApp.Screens"

chadbr
chadbr

Member

Member

53 points

27 Posts

Re: Re: beta1-&amp;gt;beta2 problem - XAML base class

Thanks Leonid -- I should have tried that instead of posting the question - it was next on my list Surprise

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities