[英]How to make an led torch/flashlight app for windows phone (Visual Studio)
[英]how to make a slideshow for windows phone 8 app in visual studio 2013?
我是Windows Phone開發的新手。 我想在C#中為帶有滑動手勢的圖像做幻燈片顯示,但是我不能...開發應用程序適用於Visual Studio 2013中的Win8。
有人知道一個好的教程或一些例子來做到這一點嗎? 干杯!
我認為您要尋找的控件是FlipView
它可以在Windows 8.1和Windows Phone 8.1上運行
使用它非常簡單,將其添加到您的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>
這是FlipView控件的簡單用法,但是一如往常,最好使用Bindings和MVVM設計模式,如果要使用的話,這就是你應該寫的
在您的XAML中:
<FlipView x:Name="Diaporama"
ItemsSource="{Binding FlipViewImage}">
<FlipView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}"
Stretch="Fill" />
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
在我的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"
};
現在,您可以通過滑動手勢更改圖片的幻燈片顯示。
我只是展示了您可以使用的基本功能,您可以在MSDN網站上找到更多信息,也可以在Google中查找
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.