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";
This shape gets animated if I open the XAML.
When I want to animate the color:
SolidColorBrush b = shp.Fill;
Storyboard.SetTargetProperty(timeline, new PropertyPath(Canvas.LeftProperty));
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
) I can get the color animation to work.
As a equivalent coding technique is used in a sample from MS
) 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?