0
StoryBoard
을 사용하여 페이드 인하거나 페이드 아웃하는 내 홈 페이지 (약 30 개)에 여러 개의 이미지가있는 것을 시도하고 있습니다. 애니메이션에서 한 장면을 완벽하게 처리하는 순간, 이렇게 보입니다.StoryBoard에서 이미지 소스 변경
private void OnDashboardPageLoaded(object sender, RoutedEventArgs e)
{
Storyboard storyboard = new Storyboard();
TimeSpan duration = new TimeSpan(0, 0, 10);
// Create a DoubleAnimation to fade the not selected option control
DoubleAnimation animation = new DoubleAnimation();
animation.From = 0.0;
animation.To = 1.0;
animation.Duration = new Duration(duration);
// Configure the animation to target de property Opacity
Storyboard.SetTargetName(animation, testImage.Name);
Storyboard.SetTargetProperty(animation, new PropertyPath(OpacityProperty));
// Add the animation to the storyboard
storyboard.Children.Add(animation);
storyboard.RepeatBehavior = RepeatBehavior.Forever;
animation.AutoReverse = true;
// Begin the storyboard
storyboard.Begin(this);
}
내 XAML; 당신은 내가 정적 소스가 여기에서 설정하지만, 궁극적으로 내가 뭘하고 싶은 것은 디렉토리에있는 모든 이미지를로드하고 각 애니메이션의 끝에서 소스를 변경하는 것입니다해야 볼 수 있듯이
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Source="http://www.online-image-editor.com/styles/2013/images/example_image.png" x:Name="testImage" Stretch="Uniform" />
</Grid>
새로운 있도록 이미지가 매번 표시됩니다 (30 개 모두 표시 될 때까지). 어떻게해야합니까?
편집 : 스토리 보드 완료시;
는storyboard.Completed += new EventHandler(Story_Completed); // In OnDashboardPageLoaded method
private void Story_Completed(object sender, EventArgs e)
{
storyboard.Begin(this);
}
* "각 애니메이션의 끝 부분에서 소스를 변경합니다"* - 'RepeatBehavior.Forever'가 더 이상 필요하지 않은 것처럼 들립니다. 오히려 하나의 애니메이션/스토리 보드를 시작하고 [끝나면] (http://stackoverflow.com/a/7333462/1997232) 뭔가를 시작하고 다른 것을 시작하십시오. '자동 반전'은 '보낸 사람'과 '받는 사람'을 교환하면 쉽게 달성 할 수 있습니다. – Sinatr
이미지를 이전 이미지 위에 블렌드하고 싶습니까 아니면 현재 이미지를 페이드 아웃 한 다음 원본을 변경하고 다음 이미지에서 사라지게할까요? – Clemens
@Clemens 후자의 Clemens, 하나가 완전히 사라지고 소스 변경 사항이 새로 추가됩니다. 메소드가 추가되어 완료된 후에 스토리 보드가 다시 시작되지만 작동하지 않습니다. 질문에 내 코드를 업데이트했습니다. – CBreeze