Custom Root Element
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{
回答
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.
すべての返信
Add assembly also to this
xmlns:MyACPUiNS="clr-namespace:ACPUi"
Replace this
<MyACPUiNS:UiPageFeature
with this
<MyACPUiNS:PageRadioWide
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!
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();
}
}
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!
- that is strange, I am using june CTP also
- Yep, strange (and frustrating =P). I appreciate your time, though. Thanks.
- do you have any XAML for the customcontrol
- can you post the complete definition of UiPageFeature class
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.
I added controls to my custompage, they seem to work fine
- mmm That's strange. Well I got what I needed for now. I appreciate your time and assistance.

