0
在一个项目中,我有一个编辑器类:当我在另一个项目中继承自定义UserControl时,为什么会出现XamlParseException?
namespace TestXamlInherit234
{
public class CustomerEditor : BaseEditor
{
public CustomerEditor()
{
TheMessage.Text = "changed222";
}
}
}
其中来自WPF用户控件继承在另一个项目:
using System.Windows.Controls;
namespace Core
{
public partial class BaseEditor : UserControl
{
public TextBlock TheMessage
{
get
{
return TheMessage2;
}
}
public BaseEditor()
{
InitializeComponent();
}
}
}
<UserControl x:Class="Core.BaseEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
<TextBlock x:Name="TheMessage2" Text="This is in the base editor"/>
</Grid>
</UserControl>
这工作当两个类是在同一个项目但是当他们在两个不同的项目中,我得到一个XamlParseException错误。
我无法得到该建议的工作,我不明白为什么在我的BaseEditor XAML中我将定义CustomerEditor类。目前,我们也只是在整个项目边界上做XAML-less的类,但是必须有一种方法来实现这个功能。 – 2009-09-30 15:20:25