मैं एक एनीमेशन XAML में परिभाषित किया गया (एक UserControl के रूप में) है कि अनिवार्य रूप से दो छवियों हर दूसरे के बीच स्विच में बना WPF स्टोरीबोर्ड को रोकने के लिए कैसे:केवल XAML
<UserControl x:Class="KaleidoscopeApplication.Controls.RemoteAnimation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="RemoteAnimation_Loaded"
Unloaded="RemoteAnimation_Unloaded">
<Grid Canvas.Left="500" Canvas.Top="84">
<Grid.Triggers>
<EventTrigger RoutedEvent="Grid.Loaded">
<BeginStoryboard>
<Storyboard x:Name="storyboard" RepeatBehavior="Forever">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="remote2" BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:2">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
<Image Name="remote1" Source="/Resources/Elements/Images/341.png"/>
<Image Name="remote2" Source="/Resources/Elements/Images/342.png"/>
</Grid>
</UserControl>
यह एक खिड़की thusly में इस्तेमाल किया जा सकता है:
<!-- Remote -->
<uControl:RemoteAnimation
x:Name="remoteAnimation"
Canvas.Left="316" Canvas.Top="156" Height="246" Width="121" />
मेरे समस्या यह है कि जब एनीमेशन युक्त खिड़की बंद कर देता है, यह चल रहा है पर रखता है और एक रिसाव का कारण बनता है। मैं Storyboard के साथ RemoteAnimation_Unloaded() के माध्यम से एनीमेशन को रोकने में सक्षम नहीं हूँ। रोकें() ... यह जैक नहीं करता है।
मैं उन पदों की दोनों की जाँच की है, लेकिन वे लागू नहीं है:
मैं उतार विधि में प्राप्त करने में सक्षम हूँ, लेकिन बुला बंद करो() बंद नहीं होता एनीमेशन। मेरी समझ से, स्टोरीबोर्ड के लिए शुरू करने के लिए कॉल() के साथ यह एक मुद्दा हो सकता है। एक isrolrolable पैरामीटर के साथ एक अधिभार है। हालांकि, चूंकि एनीमेशन पूरी तरह से एक्सएएमएल में है, इसलिए मुझे यकीन नहीं है कि इसे कैसे प्रभावित किया जाए।
धन्यवाद, मैं अपने "हमेशा के लिए" एनीमेशन को रोकने के लिए एक रास्ता तलाश रहा था लेकिन बस स्टॉप (यह) ने इसे नहीं किया। स्टार्ट (इस) विधि में "सत्य" जोड़ना चाल था। –
12 ओवरलोड के साथ शुरुआती विधि के इस गैर स्पष्ट एपीआई डिजाइन ने मुझे भी मिला है। डिफ़ॉल्ट को नियंत्रित किया जाना चाहिए क्योंकि एनिमेशन परिभाषा गतिशील हैं और शुद्ध xaml appraoach के साथ करना मुश्किल है। –