Click here to Skip to main content
15,939,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

When i am using below code in silverlight .xaml.cs page , its showing an exception on fd.ShowDialog(); line -> SecurityException was unhandled by used code.
Dialogs must be user-initialsed

OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "Text Files (.txt)|*.txt|All Files (*.*)|*.*";
fd.FilterIndex = 1;
fd.Multiselect = true;
bool? userClickedOK = fd.ShowDialog();
if (userClickedOK == true)
MessageBox.Show("in OpenFileDialog box");

so i am not getting, exactly whats the problem.
Updated 18-Oct-11 19:38pm

1 solution

The open file dialog and the save file dialogs are heavily guarded by the silverlight internal workings.

The worst of these, is that the file dialogs have to be intiated by a user generated event - such as button click.
This completely breaks MVVM standards, but its how they have designated this.[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900