我正在尝试使用 Microsoft Kinect SDK SlideShow 示例作为新项目的基础,在该项目中,我可以在网格中显示 8 个图像,这些图像可以使用 Storyboard 进行动画处理。但是,当我运行应用程序时,没有图像显示。我意识到考虑到每个图像的绑定,所有图像现在都将是相同的,但我无法显示任何图像。我得到的只是一个显示网格线的空白屏幕(用于调试)。我可以使用手势在面板中从一组 8 张图像轻弹到另一张,但没有图像显示。
你能帮我看看我做错了什么吗?
<Window x:Name="window" x:Class="Microsoft.Samples.Kinect.Slideshow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Slide Show" Height="735" Width="800" >
<Window.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff6e6e6e"/>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<Storyboard x:Key="LeftAnimate">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="previous">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="next">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="current">
<EasingThicknessKeyFrame KeyTime="0" Value="2000,0,-2000,0"/>
<EasingThicknessKeyFrame KeyTime="0:0:0.5" Value="0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="RightAnimate">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="previous">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="next">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="current">
<EasingThicknessKeyFrame KeyTime="0" Value="-2000,0,2000,0"/>
<EasingThicknessKeyFrame KeyTime="0:0:0.5" Value="0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Grid DataContext="{Binding ElementName=window}" Margin="10 0 10 0">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid>
<Grid x:Name="next" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Change the binding to the correct picture or video -->
<Image Grid.Column="0" Grid.Row="0" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="0" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="0" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="0" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="0" Grid.Row="1" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="1" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="1" Source="{Binding NextPicture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="1" Source="{Binding NextPicture}" Opacity="0"/>
<Grid x:Name="previous" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Change the binding to the correct picture or video -->
<Image Grid.Column="0" Grid.Row="0" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="0" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="0" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="0" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="0" Grid.Row="1" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="1" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="1" Source="{Binding PreviousPicture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="1" Source="{Binding PreviousPicture}" Opacity="0"/>
<Grid x:Name="current" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Change the binding to the correct picture or video -->
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="0" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="0" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="0" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="0" Grid.Row="1" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="1" Grid.Row="1" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="2" Grid.Row="1" Source="{Binding Picture}" Opacity="0"/>
<Image Grid.Column="3" Grid.Row="1" Source="{Binding Picture}" Opacity="0"/>
</Grid>
</Grid>