none
How can I rewrite the FileOpenPicker? RRS feed

  • Question

  • As we know, the UWP program can not access the file directly like WPF/Winform but can access it by the FileOpenPicker.

    So I want to not only custom the UI of FileOpenPicker but also make it can read the removable disk only.

    What's more, I don't want to declare the restricted broadFileSystem capability in its manifest to do it.

    Maybe the only way to do it is to rewrite it. But it seems it is not a control that I can not rewrite by the usercontrol.

    Is there any other way to do it? Thank you.

    Friday, November 9, 2018 3:32 AM

Answers

  • Hello mywatermelon,

    For accessing removable device you can use removableStorage capability. There is an example of TXT file I test before you can see if it helps.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by mywatermelon Friday, November 9, 2018 1:58 PM
    Friday, November 9, 2018 9:45 AM
    Moderator

All replies

  • Hello mywatermelon,

    As far as I know, the UI on Windows IoT Core is limited. Something like pop up a window is not supported on Windows IoT Core.

    And FileOpenPicker need to pop up a window to let user interact with the app via system(related message, window, application and system in Win32), like select a file. This need foundation support like Win32 UI support on desktop. So this is not a simple usercontrol in UWP. Maybe you can rewrite one but it will not be functional as you expected on Windows IoT Core.

    No legacy Win32 UI support: IoT Core does not contain APIs to create classic (HWND) Windows. Legacy methods such as CreateWindow() and CreateWindowEx() or any other methods that deal with Windows handles (HWNDs) are not available. Subsequently, frameworks that depend on such APIs including MFC, Windows Forms and WPF, are not supported on IoT Core

    Ref: "Non-UWP Apps"

    >>>So I want to not only custom the UI of FileOpenPicker but also make it can read the removable disk only.

    Do you want to limit the access of users to removable disk and prevent them from accessing on-device storage like eMMC on Dragonboard? Or OS drive like C drive?

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 9, 2018 7:22 AM
    Moderator
  • Hello mywatermelon,

    As far as I know, the UI on Windows IoT Core is limited. Something like pop up a window is not supported on Windows IoT Core.

    And FileOpenPicker need to pop up a window to let user interact with the app via system(related message, window, application and system in Win32), like select a file. This need foundation support like Win32 UI support on desktop. So this is not a simple usercontrol in UWP. Maybe you can rewrite one but it will not be functional as you expected on Windows IoT Core.

    No legacy Win32 UI support: IoT Core does not contain APIs to create classic (HWND) Windows. Legacy methods such as CreateWindow() and CreateWindowEx() or any other methods that deal with Windows handles (HWNDs) are not available. Subsequently, frameworks that depend on such APIs including MFC, Windows Forms and WPF, are not supported on IoT Core

    Ref: "Non-UWP Apps"

    >>>So I want to not only custom the UI of FileOpenPicker but also make it can read the removable disk only.

    Do you want to limit the access of users to removable disk and prevent them from accessing on-device storage like eMMC on Dragonboard? Or OS drive like C drive?

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Yes, I want to limit the access of users to removable disk and prevent them from accessing on-device storage. I do it because my customer needs to open the txt file from removable disk.

    As we know, UWP has File access permissions. If I don't open a file as StorageFolder/StorageFile, the UWP will deny the accessing.

    According to what you said above that windows iot do not support the FileOpenPicker. Then how can I open the file as StorageFolder/StorageFile? Or I can only use the broadFileSystem capability?

    Thank you.

    Friday, November 9, 2018 8:40 AM
  • Hello mywatermelon,

    For accessing removable device you can use removableStorage capability. There is an example of TXT file I test before you can see if it helps.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by mywatermelon Friday, November 9, 2018 1:58 PM
    Friday, November 9, 2018 9:45 AM
    Moderator
  • Hello mywatermelon,

    For accessing removable device you can use removableStorage capability. There is an example of TXT file I test before you can see if it helps.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Well, thanks very much!~
    Friday, November 9, 2018 1:59 PM