简体   繁体   English

如何在Visual Studio 2013中制作Windows Phone 8应用的幻灯片显示?

[英]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中查找

Msdn documentation for FlipView FlipView的MSDN文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 Windows 手机制作 LED 手电筒/手电筒应用程序 (Visual Studio) - How to make an led torch/flashlight app for windows phone (Visual Studio) Windows Phone的Visual Studio 2013设计器无法正常工作 - Visual Studio 2013 designer for Windows Phone not working Visual Studio 2013 Ultimate没有Windows Phone 8模板 - Visual Studio 2013 Ultimate no Windows Phone 8 template &#39;关联应用程序与商店&#39;选项没有显示是视觉工作室终极2013年的Windows Phone 8.1 Silverlight项目 - 'Associate App with the store' option is not showing is visual studio ultimate 2013 for windows phone 8.1 silverlight project Windows Phone:在Visual Studio 2013中将标题文本更改为图像 - Windows Phone: Change title text to image in Visual Studio 2013 在Visual Studio 2013 Windows Phone 8项目中将TypeBindConflicts放在哪里? - Where to put TypeBindConflicts in visual studio 2013 windows phone 8 project? Visual Studio 2013中缺少Windows Phone全景图模板 - Windows Phone Panorama templates missing from visual studio 2013 Visual Studio 2013 Windows Phone项目模板的疑问 - Visual Studio 2013 windows phone project templates doubts Windows Phone 8.1使用Visual Studio Ultimate 2013构建appx文件 - Windows Phone 8.1 build appx file with Visual Studio Ultimate 2013 是否可以在visual studio 2013 update 2中创建一个新的Windows Phone 8项目? - Is it possible to create a new windows phone 8 project in visual studio 2013 update 2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM