질문하기질문하기
 

답변됨Custom Root Element

  • 2006년 8월 15일 화요일 오후 2:37mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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

    {

     

답변

  • 2006년 8월 15일 화요일 오후 6:28mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨

    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.

모든 응답

  • 2006년 8월 15일 화요일 오후 2:56lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    Add assembly also to this

    xmlns:MyACPUiNS="clr-namespace:ACPUi"

  • 2006년 8월 15일 화요일 오후 3:22Brownie PointsMVP, 중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    Replace this

    <MyACPUiNS:UiPageFeature

    with this

    <MyACPUiNS:PageRadioWide

     

  • 2006년 8월 15일 화요일 오후 3:49mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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!

  • 2006년 8월 15일 화요일 오후 3:55lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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();

    }

    }

  • 2006년 8월 15일 화요일 오후 6:09mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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!

  • 2006년 8월 15일 화요일 오후 6:11lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    that is strange, I am using june CTP also
  • 2006년 8월 15일 화요일 오후 6:18mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Yep, strange (and frustrating =P). I appreciate your time, though. Thanks.
  • 2006년 8월 15일 화요일 오후 6:19lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    do you have any XAML for the customcontrol
  • 2006년 8월 15일 화요일 오후 6:27lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    can you post the complete definition of  UiPageFeature  class
  • 2006년 8월 15일 화요일 오후 6:28mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨

    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.

  • 2006년 8월 15일 화요일 오후 6:30lee d중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

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

  • 2006년 8월 15일 화요일 오후 6:45mkfl 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    mmm That's strange. Well I got what I needed for now. I appreciate your time and assistance.