Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 1.25 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to start the storyboard extract from a separate xaml file
  2. <Viewport3D x:Name="ZAM3DViewport3D" ClipToBounds="true" Width="400" Height="300" 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/interactivedesigner/2006" xmlns:c="http://schemas.openxmlformats.org/markup-compatibility/2006" c:Ignorable="d">
  3.     <Viewport3D.Triggers>
  4.         <EventTrigger RoutedEvent="Viewport3D.Loaded">
  5.     <EventTrigger.Actions>
  6.         <BeginStoryboard>
  7.             <Storyboard Duration="Forever" FillBehavior="HoldEnd" BeginTime="0:0:0" x:Name="storyboard" d:StoryboardName="OnLoaded">
  8.     .....
  9.     </Viewport3D.Triggers>
  10.  
  11.  
  12.     <ModelVisual3D>
  13.     .....
  14.     </ModelVisual3D>
  15. ......
  16. </Viewport3D>
  17.        
  18. class Model
  19. {
  20.     ModelVisual3D mv3d;
  21.     Storyboard3D sb;
  22. }
  23.        
  24. Viewport3D v3d = (Viewport3D)XamlReader.Load(FILE_STREAM);
  25. Model mm;
  26. // extract storyboard
  27. if (v3d.Triggers.Count > 0)
  28. {
  29.     var trigger = (EventTrigger)v3d.Triggers[0];
  30.     var beginSb = (BeginStoryboard)trigger.Actions[0];
  31.     mm.sb = beginSb.Storyboard;
  32. }                    
  33.  
  34. ModelVisual3D mv3d = (ModelVisual3D)v3d.Children[0];
  35. mm.mv3d = mv3d;
  36.        
  37. modeler.Children.Add(mm.mv3d);
  38.        
  39. mm.sb.begin();