This is a migrated thread and some comments may be shown as answers.

Calling the ShowFileDialog method using MVVM

4 Answers 167 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sandro
Top achievements
Rank 1
Sandro asked on 26 Apr 2012, 09:57 AM
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

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 01 May 2012, 07:15 AM
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 >>

0
Sandro
Top achievements
Rank 1
answered on 06 Jun 2012, 09:58 AM
Hi

Thank you. It helps me alot
0
Oliver
Top achievements
Rank 1
answered on 14 Sep 2012, 07:51 PM
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
0
Accepted
Tina Stancheva
Telerik team
answered on 19 Sep 2012, 03:28 PM
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.

Tags
Upload
Asked by
Sandro
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Sandro
Top achievements
Rank 1
Oliver
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or