locked
Flipview not working RRS feed

  • Question

  •  private async void flipview1_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                FileOpenPicker openPicker = new FileOpenPicker();
                openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                openPicker.ViewMode = PickerViewMode.Thumbnail;
    
                // Filter to include a sample subset of file types.
                openPicker.FileTypeFilter.Clear();
                openPicker.FileTypeFilter.Add(".bmp");
                openPicker.FileTypeFilter.Add(".png");
                openPicker.FileTypeFilter.Add(".jpeg");
                openPicker.FileTypeFilter.Add(".jpg");
    
                IReadOnlyList<StorageFile> files = await openPicker.PickMultipleFilesAsync();
    
                foreach (StorageFile Images in files)
                {
    
                    // file is null if user cancels the file picker.
                    if (Images != null)
                    {
                        // Open a stream for the selected file.
                        IRandomAccessStream fileStream = await Images.OpenAsync(FileAccessMode.Read);
    
                        // Set the image source to the selected bitmap.
                        BitmapImage bitmapImage = new BitmapImage();
    
                        bitmapImage.SetSource(fileStream);
                        image.Source = bitmapImage;
                        this.DataContext = Images;
                    }
                    //flipview1.Items.Add(Images);  // this code woking but only one image is showing 
                    flipview1.ItemsSource = Images; // An exception of type 'System.ArgumentException' occurred in test.exe but was not handled in user code
                    
                    
                }
              
            }

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <FlipView x:Name="flipview1" HorizontalAlignment="Left" VerticalAlignment="Top"  Width="1071" Height="513" Margin="123,177,0,0" SelectionChanged="flipview1_SelectionChanged">
                <Image x:Name="image" />
            </FlipView>
    flipview not working

    • Edited by luna_luna Thursday, January 2, 2014 1:27 AM
    Thursday, January 2, 2014 1:11 AM

Answers