Set Source of Image using StorageFile using FilePicker

I am developing an app in which I have called a filePicker and then the image is set as source of userImage. I am getting image through filepicker but it is not setting as source of userImage. My code is
private void pickPhoto_Tapped(object sender, TappedRoutedEventArgs e)
            MyPictureImage = true;
            FileOpenPicker photochooser = new FileOpenPicker();
            photochooser.ViewMode = PickerViewMode.Thumbnail;
            photochooser.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            photochooser.FileTypeFilter.Add(".jpg");
            photochooser.FileTypeFilter.Add(".jpeg");
            photochooser.FileTypeFilter.Add(".png");
            //Launch file open picker and caller app is suspended and may be terminated if required
            photochooser.PickSingleFileAndContinue();            
        public async void ContinueFileOpenPicker(FileOpenPickerContinuationEventArgs args)
            var values = args.ContinuationData;
            if (args.Files.Count > 0)
                StorageFile sf = args.Files[0];
                ImageEncodingProperties format = ImageEncodingProperties.CreateJpeg();
                StorageFile Image = await ApplicationData.Current.LocalFolder.CreateFileAsync(sf.Name, CreationCollisionOption.ReplaceExisting);
                StorageFile sfa = await ApplicationData.Current.LocalFolder.GetFileAsync(sf.Name);
                UploadImage(sf);
try
                    StorageItemThumbnail thumb = await file.GetThumbnailAsync(ThumbnailMode.PicturesView, 250, ThumbnailOptions.UseCurrentScale);
                    userImage.Source = await ImageFromStorageItemAsync(thumb);
                catch (Exception ex)
private async static Task<BitmapImage> ImageFromStorageItemAsync(StorageItemThumbnail item)
            BitmapImage image = new BitmapImage();
            await image.SetSourceAsync(item);
            return image;
Can anybody Help?

Your code looks good and I wasn't able to reproduce the issue.
You need to look in your "App.xaml.cs" page and make sure you have modified the "OnActivated" event to be able to navigate to the ContinueFileOpenPicker method.
protected override void OnActivated(IActivatedEventArgs args)
var root = Window.Current.Content as Frame;
var mainPage = root.Content as MainPage;
if (mainPage != null && args is FileOpenPickerContinuationEventArgs)
mainPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs);
Let me know if this helps.
Abdulwahab Suleiman

Similar Messages

  • Setting 'source' of Image component programmatically

    How do you change the source of an mx:Image component
    programmatically in ActionScript?
    I have an image like this:
    <mx:Image id="myImage"
    source="@Embed(source='image1.png')" />
    Then I want to change this in my actionscript to image2.png.
    Why does not the following code work?
    myImage.source = "@Embed(source='image1.png')";
    The image won't load, it just displays a small square icon. I
    am sure that the path is correct because it works when I use the
    Embed statement in the component declaration.
    I appreciate your help!

    The line:
    <mx:Image id="myImage"
    source="@Embed(source='image1.png')" />
    embeds the image into your SWF file at compile time. To
    change the source at run time, you'll try something like:
    myImage.source = "images/image1.png";
    Where images is your folder on the root of web application
    context you're in and image1.png is the image to be loaded.
    Here is from image class help from docs:
    The URL, object, class or string name of a class to load as
    the content. The source property takes the following form:
    source="URLOrPathOrClass"
    source="@Embed(source='PathOrClass')"
    ATTA

  • Setting source for image field

    I'm still trying to find a way around my "watermark" issues. It doesn't have to be a watermark, per se. I just need to be able to put the picture on the form based on user submission. Here's what I've done, but it's not working as I expected. Perhaps someone can help?
    The livecycle form has an image object. It also has a dropdown selection. Depending on what the user selects in the dropdown, I change the href of the image. Although the field accepts my input, it doesn't actually SHOW the image that I put referenced.
    Another important point I've left out of my previous posts....
    There is a great deal said about how it is easy to confuse changing the appearance of the document without changing the layout. Actually, this is exactly what I want to do. When I am totally done with everything, I intend to flatten the whole thing and save it as an unchangeable document. (This may require printing to a PDF print driver.) In other words, my application is not about the DATA in the form, but the LOOK of the form when it's filled out.
    So, the question of the day is....
    Given an image field, how do I programatically change the actual image it displays?

    I believe this is one of the security restrictions in Acrobat. You can't redirect to an external source programatically. If you want the user to be able to switch pictures based on a listbox selection, you must embed each picture in the document. There is a sample that covers this technique on http://www.adobe.com/devnet/livecycle/designer_scripting_samples.html
    the link is titled: "Display different images inside the same image field"
    If you want to display an image that is not embedded, you are basically stuck with the "click-and-browse" functionality that is the default behaviour of an image field.

  • Setting a background image using CSS Designer

    I am trying to set a background image for a page header using the CSS Designer. When I click the browse button the Select Image Source dialog box launches but any time I click on something the dialog box closes and no changes are made. Does anyone know what is causing this?

    Which DW are you using and which platform/OS, please? I am unable to reproduce this with CC2014 on OS10.9.4

  • Set backgrount image on RootPane using Synth L&F

    I'm using synth to create my L&F in my application and I want to set the background image in my RootPane. I have defined the style in my xml but I don't se any image.
    <style id="background">
         <opaque value="true" />
         <state>
              <imagePainter method="rootPaneBackground"
                   path="/images/background.jpg" sourceInsets="0 0 0 0" />
         </state>
    </style>
    <bind style="background" type="region" key="RootPane" />Am I doing it wrong.

    hi
    I have not answered your question but i have a query.
    What libraries are you using to create swing components using XML File.
    Actually i have a requirement :
    I must develop a GUI using swing by parsing XML documents.How to render the swing objects at run time, after parsing the XML document.I must know the process of creating the swing containers,components from XML document. Some open sources are available for the purpose but i must create a framework for our own purpose, so must know the process involved.
    kindly provide me any links or tutorial for the same.

  • How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.

    How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.
    Or how does Premiere 11 determine where to set the image for the video it is exporting? 
    I already know how to use Freeze frame and save the image to my computer by Publish+Share/Computer/ Immage.
    Thanks,
    Mike

    Mike
    This is not Adobe. Rather user to user. We are all visitors here.
    Just a bit of history....back in the days of Premiere Elements 4, you could set a "poster frame" in what was called the Project area. You did this by right clicking a blank area there and, from the drop down menu that appeared, selecting View/Preview Area, and using the poster frame feature there.
    As I said, when a video imports into Premiere Elements, the thumbnail of the import has been presenting as the first frame of the video. With this Preview area "poster frame" option, you could set the video's thumbnail in the Project area so that the first frame was another frame in the video. But, this "perk" was restricted to thumbnails of the video in Project area.
    If you exported to file with the first frame modified video, the export's thumbnail in Windows Explorer would present with other than the real first frame or the poster frame as the first frame.
    Also, in more recent versions, I have observed that the export to file does not display the real first frame of the video in Windows Explorer. Seems random, but I have not kept track.
    And, remember, at the onset I wrote
    As far as I have ever seen, Premiere Elements Windows uses the first frame of the video for its thumbnail in the program.
    I know of no way within Premiere Elements to control what the program opts to do in this matter. In some compatibility
    issues, it opts to give no image but a generic one.
    I did not say that you can expect to have the Premiere Elements' export file's thumbnail in Windows displaying with its real first frame. And, the more you get into this, depending on the versions, more details need to be added to my comment about "...first frame of video for its thumbnail in the program..."
    I would have to look into all this further to get perspective on the contributing factors.
    ATR
    Add On...The Poster Frame feature appeared in versions 4, 7, 8, and 9 by my count.

  • Setting Image control source to image in IsolatedStorage.

    Hi. I capture an Image and save it to IsolatedStorage. What's the URI (source for Image control) for IsolatedStorage to automatically display that image if it's available in IsolatedStorage? Thank you in advance.

    Try this code to retrieve the image from isoStore.
    It works for me.
    using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
    if (iso.FileExists(string.Format("image.png")))
    string fileName = "image.png";
    string filePath = iso.GetType().GetField("m_RootDir", System.Reflection.BindingFlags.NonPublic |
    System.Reflection.BindingFlags.Instance).GetValue(iso).ToString() + fileName;
    You can set the source of the Image to filePath and you won't have any problem accessing it.
    If this doesnt work, then the problem is while you are saving the image. You might have to find a workaround for saving the canvas to png or jpeg.
    If my reply answers your question, please mark this post as answered.

  • I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    Logged the call with SAP who directed me to 'Define settings for attachments' in IMG and setting the 'Deactivate Java Applet' & 'Deactivate Attachment versioning' checkboxes - problem solved.

  • How to add an image over another using af:image

    How to add an image over another using af:image
    Thanks,
    Veera

    i have a image which is black strip. i have added that to af:image
    <af:image source="image1" id="image" />
    on the black strip, i need to add company logo.
    how to achieve it.
    Thanks,
    Veera.

  • Can I attach a link to one image and then use that linked image multiple times in my site?

    Hi,
    Is it possible to attach a link to an image and then use that image (with link attached) multiple times in my site.
    Thanks,
    Ally

    Use 'Find and Replace'>under the 'Edit' menu.
    Select from 'Find in'- Folder and browse to the folder your website files are kept in to select it.
    Search: Source Code
    In the Find box (but obviously use YOUR image code):
    <img src="images/imageName.jpg" width="200" height="200" alt="" />
    In the Replace box: (use YOUR link and image code)
    <a href="yourLink.html"><img src="images/imageName.jpg" width="200" height="200" alt="" /></a>
    Then select 'Replace All'

  • Background image  for JPanel using UI Properties

    Is there any way to add background image for JPanel using UI Properties,
    code is
    if (property.equals("img")) {
    System.out.println("call image file in css"+comp);
    //set the background color for Jpanel
    comp.setBackground(Color.decode("#db7093"));
    here the comp is JPanel and we are setting the background color,
    Is there any way to put the Background image for the JPanel ????

    KrishnaveniB wrote:
    Is there any way to put the Background image for the JPanel ????Override the paintComponent(...) method of JPanel.
    e.g.
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    public class ImagePanel {
        public void createAndShowUI() {
            try {
                JFrame frame = new JFrame("Background Image Demo");
                final Image image = ImageIO.read(new File("/home/oje/Desktop/icons/yannix.gif"));
                JPanel panel = new JPanel() {
                    protected void paintComponent(Graphics g) {
                        g.drawImage(image, 0, 0, null);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(new Dimension(400, 400));
                frame.setContentPane(panel);
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            } catch (IOException ex) {
                ex.printStackTrace();
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new ImagePanel().createAndShowUI();
    }

  • Image won't use full width of page in Standard Report

    Using LabVIEW 2012 in both Windows XP and Win7
    Specifically, I'm trying to use a cluster control  with strings and numerics for a generic report page.  I stuff the strings and numerics with the info that's needed to create the desired page content.
    I am creating a standard report.  The use of Word or Excel is not considered due to compatibility issues when either NI or Microsoft release version upgrades.
    I have tried setting the report margins as well as leaving them at default; the results are the same.
    I set the header text and footer text to indicate where the report generation function believes the margins to be.  Both header and footer honor the margin settings and appear on the report page as they are expected.
    When I "append control image to report" using the reference to the cluster control, the resulting image is 6.2" wide and hugs the left margin regardless of what size the control actually is.  If the control is widened, it is rescaled to 6.2" wide.  I tried using picture and array controls; results are the same.  I tried using the "append front panel image to report"; same results.  The "Alignment" input seems to have no effect.  The issue seems to be with the way images are handled in the report generation.
    Oddly enough, the height seems to behave quite normally.  If the object is too large in height, it is simply truncated at the bottom margin.
    I tried using landscape orientation which functionally exhibits the same issue; object hangs on left margin and will not fill the width of the page.
    I tried HTML which centers the image on the page but doesn't honor margins and prints info at top and bottom that I can't get rid of.
    I contacted NI support and generated an active support question reference# 7369484.  So far, no solution.
    Any help would be appreciated!

    Similar problem using LV2011. I have to print labels on a 100x70 mm paper without borders. No chance to scale the control image to fit.
    Calculating the size of the initial picture (480x360 pixels) scaled at 96 DPI would result in a size of 127x95 mm.
    Actually the height printed is exactly this, but the width shrinked to about 45-50 mm.
    A part of the solution might be to create an image (use 'create/invoke node/get image') and send this to the printer (how to do this?). Actually the HTML report creates an 96 DPI image together with the html page.
    In my case I should create an image of at least 150 DPI (300 or 600 DPI prefered). But there are no options in either the 'get image' or append control image to standard report to set the resolution.
    Bad thing!
    Attachments:
    CT0181860494.jpg ‏26 KB

  • What is the best image rsolution to use

    I use Photoshop CS2 and DVDSP3. When adding images from photoshop to my project, what resolution should I use? 300dpi, 96, 72? I have used 30Odpi, converting the images to d1/DV NTSC picture aspect, yet they look pixelated and unclear. I used photos, not captured images from video. Do I still need to deinterlace?
    Any suggestions

    Brian
    I am afraid you are completly misinformed regarding the term dpi with regard to video.
    Video image resolution is measured in MegaHerts not dpi
    Video frame size is measured in pixels not dpi
    How is a digital video frame measured in inches, how many frames do you get to the foot?
    There is no provision for a dpi measurment in the Standards for each of the worlds formats NTSC PAL or SECAM.
    The term dpi (dots per inch) is only used in the printing industry not the video industry. Changing the dpi setting in Photoshop only has relevance when outputting to a physical printing device like a photosetter to make printing plates or to an inkjet printer to make a digital photoprint
    Users of Photoshop see there is an entry box for dpi in the image size dialogue box and wrongly assume this controls video resolution.
    To prove quickly and simply that dpi has no relevance in video try the following test:
    create a new image in Photoshop with the following settings:
    use the DV video frame size of 720 x 480
    set resolution to 72 dpi
    select the default background colour
    save the file
    in the image size dialogue box change the dpi setting to 7200 and save as a different file
    import both the images into FCP and look at the two images
    according to your thinking, the 72 dpi image will be a standard DV video image and the 7200 dpi image a very high resolution image at 100 times the first
    but what do you find?
    not only are both images the same file size in Kilobytes
    they have exactly the same video resoluton viewed in FCP.
    How can this possibly be?
    Simply because video has no clue to what dpi is or means, video ignores dpi completly
    Best practice; - when making images for video, use the correct frame size for the format being used and ignore the dpi setting. Life will be much less confusing thereafter
    Gary

  • How do I spot what images are RGB using the separations preview?

    2 Questions: 1. How do I spot what images are RGB using the separations preview? 2. Is there an easy way to convert those to CMYK without opening each one in PS? I did this before all the time but I'm rusty and can't remember how I did it. I'm on CS6.

    You can one of several methods to find out:
    (1) You can use the Links panel.  Open the Links panel. Go the panel menu and choose Panel Options. In the Panel Options dialog, Under Show Column check "Color Space". Now when you view your Links panel it will show the color space of all linked images.
    (2) You could use Preflight, and set up a Preflight Profile. In the profile, go to the Color section > Color Spaces and Modes Not Allowed, and check RGB. Then any RGB images would be flagged.
    (3) If you need to know BEFORE you place the images, use Adobe Bridge. Open the folder where the image are. Use the Metadata panel and view the color space of the images.

  • How to get file from temp foldre using StorageFile.GetFileFromPathAsync()

    Hi,
    I am trying to download a .pdf in the temp folder.
    Here is the code
    var uri = new Uri("http://www.nakcollection.com/uploads/7/7/7/4/7774039/the_man_in_the_red_underpants_book.pdf");
    StorageFolder folder = ApplicationData.Current.TemporaryFolder;
    StorageFile file = await folder.CreateFileAsync("one.pdf");
    BackgroundDownloader download = new BackgroundDownloader();
    DownloadOperation downloader = download.CreateDownload(uri, file);
    StorageFile file1 = await StorageFile.GetFileFromPathAsync("");
    Now I want to use that file how can I get that file using
    StorageFile.GetFileFromPathAsync("");
    samEE

    Thanks, a lot it worked :)
    Here is the revised version of the code. It might help others too. :)
    var uri = new Uri("http://www.nakcollection.com/uploads/7/7/7/4/7774039/the_man_in_the_red_underpants_book.pdf");
    StorageFolder folder = ApplicationData.Current.TemporaryFolder;
    StorageFile file = await folder.CreateFileAsync("one.pdf",CreationCollisionOption.ReplaceExisting);
    if(file !=null)
    //Download form uri to file
    BackgroundDownloader download = new BackgroundDownloader();
    DownloadOperation downloader = download.CreateDownload(uri, file);
    //set download priority
    downloader.Priority = BackgroundTransferPriority.High;
    //request uncontrained download
    UnconstrainedTransferRequestResult result = await
    BackgroundDownloader.RequestUnconstrainedDownloadsAsync(new DownloadOperation[] { downloader });
    // start downloading
    await downloader.StartAsync();
    //the download is now finished
    var tempUri = new Uri("ms-appdata:///temp/one.pdf");
    StorageFile file1 = await StorageFile.GetFileFromApplicationUriAsync(tempUri);
    if (file1 != null)
    //user defined function for further usage of file
    LoadFile(file1);
    samEE

Maybe you are looking for