• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
.NET Framework Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > Custom Root Element
Ask a questionAsk a question
Search Forums:
  • Search Windows Presentation Foundation (WPF) Forum Search Windows Presentation Foundation (WPF) Forum
  • Search All .NET Development Forums Search All .NET Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

AnswerCustom Root Element

  • Tuesday, August 15, 2006 2:37 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    I have a page class (PageRadioWide) in which I want to inherit from UiPageFeature but I'm getting the following error:

    PageRadioWide.xaml(2,5): error MC3074: The tag 'UiPageFeature' does not exist in XML namespace 'clr-namespace:ACPUi'. Line 2 Position 5.

    Can anyone provide some assistance? Thanks in advance.

    Here's some additional information:

    XAML File:

    <MyACPUiNS:UiPageFeature

    x:Class="ACPUiTempTestApp.PageRadioWide"

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

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

    xmlns:MyACPUiNS="clr-namespace:ACPUi"

    xmlns:ACPUiNS="clr-namespace:ACPUi;assembly=ACPUi"

    xmlns:ACPUiTempTestAppNS="clr-namespace:ACPUiTempTestApp"

    Title="PageRadioWide"

    >

    Code-Behind File:

    public partial class PageRadioWide : ACPUi.UiPageFeature

    Generated g.cs File:

    public partial class PageRadioWide : ACPUi.UiPageFeature

    ACPUi Namespace:

    namespace ACPUi

    {

    /// <summary>

    /// Interaction logic for UiPageFeature.xaml

    /// </summary>

    public partial class UiPageFeature : System.Windows.Controls.Page

    {

     

    • ReplyReply
    • QuoteQuote
     

Answers

  • Tuesday, August 15, 2006 6:28 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Vote As Helpful
    0

    mmm interesting I just ran across this post: "Inheriting from inherited user control"

    "...

    But then I get: "Error 7 'MyBaseUserControl' cannot be the root of a XAML file because it was defined using XAML."

    I can get it working if I convert it to a CustomControl (no xaml definition), but I loose the declarative inheritance.... mmm... I suppose I still can use templates and styles to reach that.

    Is this a XAML "design decision"?"

    ..so I changed my Custom Page from a WinFx Page file (XAML) to a Class file  (no XAML) and it seems to compile now but I guess I can't do any XAML coding in my Custom Page.

    • ReplyReply
    • QuoteQuote
     

All Replies

  • Tuesday, August 15, 2006 2:56 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    Add assembly also to this

    xmlns:MyACPUiNS="clr-namespace:ACPUi"

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 3:22 PMBrownie PointsMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    Replace this

    <MyACPUiNS:UiPageFeature

    with this

    <MyACPUiNS:PageRadioWide

     

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 3:49 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    I tried that originally by using: xmlns:ACPUiNS="clr-namespace:ACPUi;assembly=ACPUi"

    But I got the following error: PageRadioWide.xaml(2,5): error MC6017: 'ACPUi.UiPageFeature' cannot be the root of a XAML file because it was defined using XAML. Line 2 Position 5.

    In another posting I noticed someone said to remove the assembly so I added: xmlns:MyACPUiNS="clr-namespace:ACPUi" for the root element (UiPageFeature) and kept the other namespace for my other user controls (b/c that one requires the assembly). Removing the assembly got rid of the above error but introduced the this one:

    PageRadioWide.xaml(2,5): error MC3074: The tag 'UiPageFeature' does not exist in XML namespace 'clr-namespace:ACPUi'. Line 2 Position 5.

    Is there a way to resolve the first error then, if I add back the assembly?

    Thanks!

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 3:55 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    something like this should work

    namespace Lee.Controls

    {

    public partial class CustomPage : System.Windows.Controls.Page

    {

    ...

     

    }}

    <qa:CustomPage x:Class="winjun.Page3"

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

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

    Title="Page3"

    xmlns:qa="clr-namespace:Lee.Controls;assembly=Lee.Controls"

    >

    <Canvas Width="200" Height="200" Background="Yellow"></Canvas>

    </qa:CustomPage>

    public partial class Page3 : Lee.Controls.CustomPage

    {

    public Page3()

    {

    InitializeComponent();

    }

    }

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:09 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    Thanks for your reply.

    I've double-checked my implementation and it matches your sample above. I also tried a test app with the above code and got the same results:

    Page3.xaml(1,16): error MC6017: 'Lee.Controls.CustomPage' cannot be the root of a XAML file because it was defined using XAML. Line 1 Position 16.

    I'm using the June CTP. Is anyone aware of any known issues?

    Thanks!

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:11 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    that is strange, I am using june CTP also
    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:18 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    Yep, strange (and frustrating =P). I appreciate your time, though. Thanks.
    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:19 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    do you have any XAML for the customcontrol
    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:27 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    can you post the complete definition of  UiPageFeature  class
    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:30 PMlee dModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    I added controls to my custompage, they seem to work fine

    • ReplyReply
    • QuoteQuote
     
  • Tuesday, August 15, 2006 6:45 PMmkfl Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    mmm That's strange. Well I got what I needed for now. I appreciate your time and assistance.
    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement