VSM breaking the XAML – Silverlight 2 issue and workaround.

After spending some time skinning applications I have come across a little bug in the system that seems to cause the application to break.

Every time I edit something with the Visual State Manager within Expression Blend, it edits the XAML to a point where the application won’t run.

Here is the error

So there is the error in Visual Studio -
XamlParserException occurred.
DataTemplate does not support Comment as content.

After a little bit of investigation, I found that when i edited the item in VSM, saved it and continued to build and test the application in Visual Studio, it was not building because Blend was changing the XAML to read:

<ItemsControl VerticalAlignment=”Top” x:Name=”Comments” Grid.Row=”1″ >
<ItemsControl.ItemTemplate>
<vsm:DataTemplate>
<my:Comment x:Name=”CommentItem”/>
</vsm:DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

The problem being the vsm: in front of the DataTemplate tag, it is what was breaking the application and to simply remove it would fix the issue and all my updates worked.

So there is the workaround for the issue but I would love to work out if its a bug or if there is something I can do to avoid it completely.

Any thoughts?


5 Comments so far
Leave a comment

I think the workaround would be to define vsm at your assembly references.

I’m not able to test here though, but it might work.

Comment by ruurd boeke

VSM is already defined in the XAML at the top so you shouldnt need to define it in the code behind, I was also told to take the reference out and try but it broke it even more.

Comment by agkdesign

From what I’ve seen this is a bug in Blend.

http://silverlight.net/forums/t/17492.aspx

The forum states that blend isn’t supposed to be adding the vsm namespace to the DataTemplate.

Comment by Mike

Sweet thanks Mike. Gets pretty annoying every time i change something it adds it back in there and then i have to remove it manually to build the project…. Lets hope its all sorted next edition.

Comment by agkdesign

[...] – bookmarked by 5 members originally found by laolao on 2008-11-30 VSM breaking the XAML – Silverlight 2 issue and workaround. [...]

Pingback by Bookmarks about Breaking




Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>