1

我不能像Windows Phone中的图像库一样顺利交换。显示图像交换像Windows Phone中的图片库C#

我试过flip gesture listener,它能够交换图像但不能平滑交换。

我试图搜索,但没有得到任何答案。我试图以画廊视图的方式显示图像列表。我从过去3天开始挣扎。如果你给我一些建议或链接,请给予帮助。

+1

你的问题并不十分清楚。当你说顺利时,你的意思是它不是动画或动画是以非常低的帧率运行的? – 2013-04-27 09:12:56

+1

@ dr.mo让我说清楚。我有一个图像列表,现在我想查看它像在Windows Phone中的照片库图像视图。我在这里没有做任何动画,我只是将我的图像从左到右或反之亦然,以查看列表中的所有图像。我能够做到这一点,但你在Windows手机画廊找到的动画查看图像,我不能做到这一点,它应该像画廊一样工作。请帮助我... – 2013-04-27 09:17:46

+0

@SanghatiMukherjee您想要在一个屏幕后查看其他图片或列表中的图片吗?如果你让我知道你想要哪一个我有一些想法,可以工作..我会尽力给你的代码或告诉你如何可以做.. – Apoorva 2013-05-07 04:54:19

回答

1

这是一个简单的例子,我刚建的向你展示它如何做..希望你能有所帮助

<phone:PhoneApplicationPage xmlns:Controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
x:Class="PhotoChooser.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
FontFamily="{StaticResource PhoneFontFamilyNormal}" 
FontSize="{StaticResource PhoneFontSizeNormal}" 
Foreground="{StaticResource PhoneForegroundBrush}" 
SupportedOrientations="Portrait" Orientation="Portrait" 
shell:SystemTray.IsVisible="True"> 

<!--LayoutRoot is the root grid where all page content is placed--> 
<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <!--TitlePanel contains the name of the application and page title--> 
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
     <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/> 
     <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> 
    </StackPanel> 

    <!--ContentPanel - place additional content here--> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
     <ListBox x:Name="lbImages"> 
      <ListBox.ItemTemplate> 
       <DataTemplate> 
        <Controls:Panorama> 
         <Controls:PanoramaItem> 
          <Image Source="{Binding ImageName}"/> 
         </Controls:PanoramaItem> 
        </Controls:Panorama> 
       </DataTemplate> 
      </ListBox.ItemTemplate> 
     </ListBox> 
    </Grid> 
</Grid> 

与此设计器的类文件是这样的

public partial class MainPage : PhoneApplicationPage 
{ 
    public MainPage() 
    { 
     InitializeComponent(); 

     PanoramaItem panItem = new PanoramaItem(); 
     List<ImageList> imgList = new List<ImageList>(); 


     imgList.Add(new ImageList() { ImageName = ImagePath.Image4 }); 
     lbImages.ItemsSource = imgList; 
    } 

    public class ImageList 
    { 
     public string ImageName { get; set; } 
    } 
} 

这实际上工作顺利,看起来也不错..有很多方法可以实现你正在尝试。请让我知道这是否有效。如果这不适合你,我会建议其他人!