![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |