Calling the ShowFileDialog method using MVVM

5 posts, 1 answers
  1. Sandro
    Sandro avatar
    18 posts
    Member since:
    Jan 2011

    Posted 26 Apr 2012 Link to this post

    Hi

    I do not know how am I going to call the ShowFileDialog of RadUpload control using MVVM.
    I have a button and RadUpload (Visibility = Collapse). I want the button to call the RadUpload.ShowFileDialog.

    Thank you in advance
  2. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 01 May 2012 Link to this post

    Hi,

    RadUpload control contains a built in button opening the file dialog. In Silverlight, opening file dialogs must be initiated by a user interaction due to security considerations. Thus we have imbued the opening button inside RadUpload.
    If you however want to open the file dialog from the MVVM you could employ some of the following:
    1) Using an interaction service, more info here http://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx 
    2) Inject the methods used for dialog opening - a simplified variation of the above, more info here http://www.deanchalk.me.uk/post/WPF-MVVM-e28093-Simple-e28098MessageBoxShowe28099-With-Action-Func.aspx 

    Also a quick search on Google about MVVM and popups (or messageboxes) will bring a tons of results related to your solution.
    Hope this helps, please let us know if you need further assistance.

    Greetings,
    Hristo
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Sandro
    Sandro avatar
    18 posts
    Member since:
    Jan 2011

    Posted 06 Jun 2012 Link to this post

    Hi

    Thank you. It helps me alot
  5. Oliver
    Oliver avatar
    1 posts
    Member since:
    Jan 2012

    Posted 14 Sep 2012 Link to this post

    Hi there
    When i try to upload a file with the "normal" upload dialog in silverlight, i've got a Security Exception. To resolve this, i have to trust my application with a certificate and run the application in elevated trust. Is this also needed if i use your RadUpload control or do you "fake" this Upload call with some json or anything else?

    Thx for your feedback
  6. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Sep 2012 Link to this post

    Hello Oliver,

    The RadUpload control sends a request to the RadUploadHandler which is essentially an HttpHandler. It allows you to select files from the client machine and then it creates a collection of RadUploadSelectedFile objects and each object contains the name and the FileInfo describing the file selected by the user.

    This is why you should be able to upload the files out-of-the-box.

    Regards,
    Tina Stancheva
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top
DevCraft banner