2

我无法让 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,但不会命中属性。

欢迎任何指点!

4

1 回答 1

2

这看起来像是 Blend 4 Silverlight 5 预览版中的一个错误。我有同样的问题。

这里有一个线程

http://social.expression.microsoft.com/Forums/ro-RO/blend/thread/b91286c2-c97f-4ca1-84c8-99fa144e3b8e#5d345518-1094-40f0-bfd3-c49e3d156fd0

看起来 MSFT 知道这件事。

于 2011-11-30T02:42:57.673 回答