Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Serialization to XAML and registered names do not work

 
 
Old 08-26-2007   #1 (permalink)
Ralf Ziller


 
 

Serialization to XAML and registered names do not work

I am building some animations through code and serialize them to xaml-files
with the XAMLWriter.
This all works perfect as long as the element the animation targets has a
own name-property. I can assign a name, register it with the canvas:

shp.Name = "shp1";
canvas.RegisterName(shp.Name, shp);
Storyboard.SetTargetProperty(timeline, new
PropertyPath(SolidColorBrush.ColorProperty));
Storyboard.SetTargetName(timeline, shp.Name);

This shape gets animated if I open the XAML.

When I want to animate the color:

SolidColorBrush b = shp.Fill;
canvas.RegisterName("brush1",b);
Storyboard.SetTargetProperty(timeline, new PropertyPath(Canvas.LeftProperty));
Storyboard.SetTargetName(timeline, "brush1");

This does not work. Looking in the resulting XAML I see there is no name
assigned to the brush. If I add a name (x:Name="brush1") and add the
respective x-namespace
(xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
) I can get the color animation to work.

As a equivalent coding technique is used in a sample from MS
(http://msdn2.microsoft.com/en-us/library/aa970561.aspx) I suppose this will
work if I show the results directly and the registered name gets lost during
serialization to XAML. Is there anything I have to do with namespaces or is
there now way of serializing those names?

Ralf

My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46