我无法让 Blend(v5) 与我的 DesignInstance 一起正常工作。
我有一个简单的项目..
主页.xaml
<UserControl x:Class="SilverlightApplication8.MainPage"
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:local="clr-namespace:SilverlightApplication8"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance local:VM,IsDesignTimeCreatable=True}"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Background="White">
<TextBlock Text="{Binding Test}" />
</Grid>
</UserControl>
和VM.cs _
public class VM
{
public string Test
{
get { return "Hello World"; }
}
}
正如预期的那样,在我的 VS2010 设计器中,它显示“Hello World”。但是,如果我将项目加载到 Blend (v5) 中,则它不会显示任何内容(空白控件)。谁能指出我做错了什么?
一个有趣的事实.. 如果我在 VM.cs 的 ctor 中放置一个断点,并附加到 Blend,它确实会命中 ctor,但不会命中属性。
欢迎任何指点!