Possible Duplicate:
Inheriting from a UserControl in WPFMyUserControl no puede ser la raíz de un archivo XAML porque se define usando XAML
Estoy intentando crear un control de usuario de WPF, que se deriva de otro control de usuario, que también he definido.
<myNamespace:NavigationControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:myNamespace="clr-namespace:myNamespace" mc:Ignorable="d"
x:Class="myNamespace.WelcomeScreen"
x:Name="UserControl"
d:DesignWidth="640" d:DesignHeight="480">
y esto es lo que se ve como WelcomeScreen.cs:
public partial class WelcomeScreen : NavigationControl
{
public WelcomeScreen()
{
this.InitializeComponent();
}
}
Cuando compilo este, consigo el error siguiente:
'myNamespace.NavigationControl' cannot be the root of a XAML file because it was defined using XAML.
¿Qué estoy haciendo mal?
para la solución de WPF con herencia visual, consulte: http://svetoslavsavov.blogspot.gr/2009/09/user-control-inheritance-in-wpf.html o para definir explícitamente la GUI en el antecesor, vea http: // support.microsoft.com/kb/957231 –