0

I am trying to subclass a UserControl after reading the following: How can a WPF UserControl inherit a WPF UserControl?

But I seem to have missed something.

Base class, which is not partial nor does it have an XAML:

namespace HTTPFreeForm
{
    public class HTTPBaseForm : UserControl, IForm
    /* ... more content ... */
}

Subclass codebehind:

namespace HTTPFreeForm
{
    public partial class HTTPFreeForm : HTTPBaseForm
    /* ... more content ... */
}

Subclass XAML:

<local:HTTPBaseForm x:Class="HTTPFreeForm.HTTPFreeForm" 
             xmlns:local="clr-namespace:HTTPFreeForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <!-- ... more content ... -->
</local:HTTPBaseForm>

When I try to build, I receive the following error:

Error 2 The type name 'HTTPBaseForm' does not exist in the type 'HTTPFreeForm.HTTPFreeForm' c:\MyProject\HTTPFreeForm\obj\Debug\HTTPFreeForm.g.cs 42 54 HTTPFreeForm

What am I missing or doing wrong?

4

1 回答 1

2

根据要求评论回答。

您的名称空间与类的名称有冲突。改变它,然后再试一次。

于 2013-06-20T13:16:58.590 回答