3
我有一個單獨的XAML文件看起來像這樣:如何提取Viewport3d.Triggers故事板在WPF
<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">
<Viewport3D.Triggers>
<EventTrigger RoutedEvent="Viewport3D.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Duration="Forever" FillBehavior="HoldEnd" BeginTime="0:0:0" x:Name="storyboard" d:StoryboardName="OnLoaded">
.....
而且我已經在計劃中的代碼,該段:
....
FileStream fs = new FileStream(mm.path, FileMode.Open, FileAccess.Read); //
Viewport3D v3d = (Viewport3D)XamlReader.Load(fs);
....
我想知道如何從EventTrigger.Actions中提取故事板。我想這應該是這樣的:
Storyboard sb = (Storyboard)v3d.Triggers[0]....
有誰知道如何做到這一點?