Search code examples
silverlightxamlblenddesign-time-data

DesignInstance working in VS2010, but not in Blend5


I cannot get Blend(v5) to work correctly with my DesignInstance.

I have a simple project with..

MainPage.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>

and VM.cs with

public class VM
{
        public string Test
        {
            get { return "Hello World"; }
        }
}

As expected, in my VS2010 designer, it shows "Hello World". However, if I load the project into Blend (v5), then it shows nothing (blank white control). Can anyone point out what I have done wrong?

One interesting fact.. If I put a break point in the ctor of VM.cs, and attach to Blend, it DOES hit the ctor, but DOES NOT hit the property.

Any pointers would be welcomed!


Solution

  • This looks like a bug in Blend 4 Silverlight 5 preview. I'm having the same issue.

    There is a thread here

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

    Looks like MSFT know about it.