Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:03:47+00:00 2026-05-31T07:03:47+00:00

Am making an application in WP7 using Windows Phone SDK 7.1 / C# Am

  • 0

Am making an application in WP7 using Windows Phone SDK 7.1 / C#

Am using photo chooser task. But I want to select 9 images and here I can select only one Image.

How can I select 9 images at a stretch?

Please Help me, here is my code:

public partial class MainPage : PhoneApplicationPage
{
    PhotoChooserTask photoChoserTask;
    // Constructor
    public MainPage()
    {
        InitializeComponent();
    photoChoserTask = new PhotoChooserTask();
    photoChoserTask.Completed += 
             new EventHandler<PhotoResult>(photoChooserTask_Completed);
    }


void photoChooserTask_Completed(object sender, PhotoResult e)
{
  if (e.TaskResult == TaskResult.OK)
  {
     y.Text= (e.ChosenPhoto.Length.ToString());

    //Code to display the photo on the page in an image control named myImage.
    //System.Windows.Media.Imaging.BitmapImage bmp = 
            //new System.Windows.Media.Imaging.BitmapImage();
    //bmp.SetSource(e.ChosenPhoto);
    //myImage.Source = bmp;
  }
}

private void Button_Click(object sender, RoutedEventArgs e)
{       
    {
        try
        {
            photoChoserTask.Show();
        }
        catch (System.InvalidOperationException )
        {
            MessageBox.Show("An error occurred.");
        }
    }
}

}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:03:48+00:00Added an answer on May 31, 2026 at 7:03 am

    Whilst PhotoChooserTask will only allow the user to select one image from their library (or capture a new one from their camera if you set ShowCamera to true) another option would be to continue to allow the user to iteratively select images and not allow them to continue until they have selected 9 (I believe that’s the requirement you’re after?)

    public partial class MainPage : PhoneApplicationPage {
        public class SelectedPhoto : IDisposable {
            public Stream Data { get; private set; }
            public string Name { get; private set; }
            public BitmapImage Image { get; private set; }
    
            public SelectedPhoto(string name, Stream photo) {
                Name = name;
    
                Data = new MemoryStream();
                photo.CopyTo(Data);
    
                Image = new BitmapImage();
                Image.SetSource(Data);
            }
    
            public void Dispose() {
                Data.Dispose();
            }
        }
    
        private List<SelectedPhoto> _selectedPhotos = new List<SelectedPhoto>();
        private PhotoChooserTask photoChoserTask;
    
        // Constructor
        public MainPage() {
            InitializeComponent();
            photoChoserTask = new PhotoChooserTask();
            photoChoserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
    
            ProcessImages.IsEnabled = false;
            ImageListBox.ItemsSource = _selectedPhotos
        }
    
    
        void photoChooserTask_Completed(object sender, PhotoResult e) {
            if (e.TaskResult == TaskResult.OK) {
                _selectedPhotos.Add(new SelectedPhoto(e.OriginalFileName, e.ChosenPhoto);
    
                Button.IsEnabled = _selectedPhotos.Count < 9;
                ProcessImages.IsEnabled = _selectedPhotos.Count == 9;
            }
        }
    
        private void Button_Click(object sender, RoutedEventArgs e) {
            {
                try {
                    photoChoserTask.Show();
                } catch (System.InvalidOperationException) {
                    MessageBox.Show("An error occurred.");
                }
            }
        }
    
        private void ProcessImages_Click(object sender, RoutedEventArgs e) {
            MessageBox.Show("Doing something with your images... please wait...");
        }
    }
    

    In your XAML rather than having a single Image you’d want to put an Image inside a ListBox‘s DataTemplate and show all of the user’s currently entered images (probably with an option to erase an image and add a different image instead). Eg;

        <ListBox x:Name="ImageListBox">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <Image Source="{Binding Image}" />
                        <TextBlock Text="{Binding Name}" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    
        <Button x:Name="ProcessImages" Click="ProcessImages_Click" />
    

    If the requirement is to have up to 9 images, I’d prefer this approach, over a custom multi-select image selector, for a few reasons reasons;

    1. It provides the user with a consistent user experience – the same as they’d get in any other app
    2. By making use of the MediaLibrary your application will require the ID_CAP_MEDIALIB capability (Shows up as “Access media library”, I believe).
    3. I’d find this method a bit less work than a full blown media choser.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am making application using phone gap in which certain html pages in
i am making application in C#. Here i want to find out the number
I am making a WP7 Silverlight application and using a ViewModel to store the
I am making an application for a windows mobile smartphone, and I would like
I am making an application which needs a dial pad to dial phone number
I'm making an application server client using tcp sockets in c# .. The application
I'm currently making an application for WP7 where I'm implementing a currency exchange solution.
I'm making an application with wxWidgets that has a listbox in it. I want
I'm currently making a WP7 application with a pivot control. I am making use
I'm currently making a game for WP7 which is mostly made in Silverlight. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.