0
votes

I a working on a simple window phone application. In which I have two filed Name and Images.

I want to save this item and want to view all saved data.

Now My query How to select images to save? and How to save images and also get images to view.

I also used PhotoChooserTask but How to save selected image and how to get saved images? I know about how to save image file in Isolated storage. But how to save selected images and get all data?

Thanks, Hitesh.


Thanks for your reply. I knew about photoChooserTask. I also save my image file in isolated storage. But I dont know what is the images path to save images path in database and how to display all those images in datagrid. I have a table which have fields like ID, Name and Image path. I dont know what to save in imagepath filed if I saved image in isolated storage and how to display all data in datagrid.I used following code to save data into database. IN below code please correct the image path if I was wrong.

CategoryVO newCategory = new CategoryVO()
    {
        Name = txtCategoryName.Text,
        ImagePath = txtCategoryName.Text.Trim() + ".jpg"
    };
    Expdb.Category.InsertOnSubmit(newCategory);
    Expdb.SubmitChanges();
1
Be careful with your tags. Your title says Windows Phone 8, but you tagged the question Windows Phone 7.Michael Itzoe

1 Answers

0
votes

Using the PhotoChooserTask you can actually launch the photo chooser application and handle the selected image. If you want to integrate this in your application, create the instance of the PhotoChooserTask and call the Show() method. If you want to handle the user’s selection, register the Completed event which will give you handle of the chosen photo.

var photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += PhotoChooserTaskCompleted;
photoChooserTask.Show();

In the completed event implementation, you can get the chosen image as PhotoResult and set the image to your Image control or can use it in other places.

void PhotoChooserTaskCompleted(object sender, PhotoResult e)
{
    switch (e.TaskResult)
    {
        case TaskResult.OK:
            imageChooser.Source = new BitmapImage(new Uri(e.OriginalFileName));
            break;
    }
}

Source: http://www.codeproject.com/Articles/350126/How-to-use-the-PhotoChooserTask-to-Launch-the-Medi