locked
An error when opening FileOpenPicker and FileSavePicker in the 'Snapped' mode RRS feed

  • Question

  • Hello,

    I am using VS 2012 RC, Metro Application, C#. If to use FileOpenPicker and FileSavePicker, when the application is in the Snapped mode, there is an exception:
    Error HRESULT E_FAIL has been returned from a call to a COM component.

    In other modes, no problems found.
    Using the following code (if needed I can send a sample project):


    var openPicker = new FileOpenPicker();
    openPicker.FileTypeFilter.Add(".txt");
    openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
    
    StorageFile storageFile = await openPicker.PickSingleFileAsync(); // !!! Error
    if (storageFile != null)
    {
    }
    

    Thank you.

    Friday, June 8, 2012 10:26 AM

Answers

  • This seems to be by design, we hit the same problem with the contact picker.

    http://connect.microsoft.com/VisualStudio/feedback/details/743156/fileopenpicker-picksinglefileasync-throws-comexception-if-app-is-snapped-to-the-side


    Can Bilgin
    Blog CompuSight

    Friday, June 8, 2012 12:10 PM

All replies

  • This seems to be by design, we hit the same problem with the contact picker.

    http://connect.microsoft.com/VisualStudio/feedback/details/743156/fileopenpicker-picksinglefileasync-throws-comexception-if-app-is-snapped-to-the-side


    Can Bilgin
    Blog CompuSight

    Friday, June 8, 2012 12:10 PM
  • You can call TryUnsnap before that operation

    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Friday, June 8, 2012 4:48 PM
  • I had the same problem.

    Here is what  I did.

     ApplicationViewState myViewState = ApplicationView::Value;
    
                        if (myViewState == ApplicationViewState::Snapped)
    					{
    						
    auto boxOK =
            ref new Windows::UI::Popups::MessageDialog("Cant merge file in snapped view");
        boxOK->ShowAsync();
    						return;
    					}
    
    
    					mergepcb();
    


    n.Wright

    Monday, September 2, 2013 11:25 PM