【发布时间】:2009-01-28 04:59:51
【问题描述】:
我有一个在我的应用程序中使用的 XAML 表单,我将 Frame 类子类化为我自己的,并编辑了接口以指定我自己的内容类(因为我需要访问数据内容的属性绑定)。
问题出现在设计器中,编译器说它无法创建我的控件的实例 - 我尝试对有问题的属性位进行一些设计器检查,但也没有用。
如何让控件显示?在运行时运行良好...
XAML:
<Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2">
<views:PageFrame Name="Content_MainPage" Frame.NavigationUIVisibility="Hidden"/>
</Grid>
CS:
public new BaseView Content
{
get
{
if (DesignerProperties.GetIsInDesignMode(this))
{
return new BaseView();
}
else
{
return (BaseView)base.Content;
}
}
set
{
if (DesignerProperties.GetIsInDesignMode(this))
{
base.Content = new BaseView();
FrameTitle = "design mode";
}
else
{
base.Content = value;
FrameTitle = value.Title;
}
}
}
【问题讨论】: