[英]how to make a slideshow for windows phone 8 app in visual studio 2013?
I am new to Windows Phone Dev. 我是Windows Phone开发的新手。 I d like to do a slideshow of for images with swipe gesture in C#, but i cant... The development app is for Win8 in visual studio 2013. 我想在C#中为带有滑动手势的图像做幻灯片显示,但是我不能...开发应用程序适用于Visual Studio 2013中的Win8。
Somebody know a good tutorial or some example to do this? 有人知道一个好的教程或一些例子来做到这一点吗? Cheers! 干杯!
I think the control you are looking for is the FlipView 我认为您要寻找的控件是FlipView
It will work on both Windows 8.1 and Windows phone 8.1 它可以在Windows 8.1和Windows Phone 8.1上运行
Using it is very simple, add that in your XAML: 使用它非常简单,将其添加到您的XAML中:
// SelectionChanged event will be fired every time a picture changes (optional)
<FlipView x:Name="flipView1" SelectionChanged="FlipView_SelectionChanged">
// Of course replace the source with the relative paths
// of the pictures you want to show
<Image Source="Assets/Logo.png" />
<Image Source="Assets/SplashScreen.png" />
<Image Source="Assets/SmallLogo.png" />
</FlipView>
This is the simple usage of a FlipView control, but as always it is better to use Bindings and MVVM design pattern, in case you are using it here is what you should write 这是FlipView控件的简单用法,但是一如往常,最好使用Bindings和MVVM设计模式,如果要使用的话,这就是你应该写的
In your XAML: 在您的XAML中:
<FlipView x:Name="Diaporama"
ItemsSource="{Binding FlipViewImage}">
<FlipView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}"
Stretch="Fill" />
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
And in my ViewModel: 在我的ViewModel中:
// I binded the FlipView with FlipViewImage
// which is a list of strings (each string being a path)
private List<string> _flipViewImage;
public List<string> FlipViewImage
{
get { return _flipViewImage; }
set
{
_flipViewImage = value;
NotifyPropertyChanged("FlipViewImage");
}
}
// Then I fill the list
FlipViewImage = new List<string>
{
// Again replace the image paths with your own
"../Assets/Seel_photo_Aurelien.png",
"../Assets/shop_woman.jpg",
"../Assets/Poster.jpg"
};
You now have a slideshow of pictures that you can change with swipe gesture. 现在,您可以通过滑动手势更改图片的幻灯片显示。
I just showed the basic stuff you can do with it, you can find more on the MSDN website or looking in Google 我只是展示了您可以使用的基本功能,您可以在MSDN网站上找到更多信息,也可以在Google中查找
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.