我需要将OpenDialog窗口放在Silverlight应用程序的浏览器窗口中。我想知道是否有可能。任何帮助都非常感谢!
下面是我打开子窗口和OpenDialog的代码:
private void openChildWindow_Click(object sender, System.Windows.RoutedEventArgs e)
{
Add_ChildWindow ap = new Add_ChildWindow();
ap.Show();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
// Set filter options and filter index.
openFileDialog1.Filter = "Packages (*.sprj)|*.sprj|Packages (*.sprj)|*.sprj";
openFileDialog1.FilterIndex = 1;
openFileDialog1.Multiselect = true;
// Call the ShowDialog method to show the dialog box.
bool? userClickedOK = openFileDialog1.ShowDialog();
// Process input if the user clicked OK.
if (userClickedOK == true)
{
// Open the selected file to read.
//textBox1.Text = openFileDialog1.File.Name;
System.IO.Stream fileStream = openFileDialog1.File.OpenRead();
using (System.IO.StreamReader reader = new System.IO.StreamReader(fileStream))
{
// Read the first line from the file and write it the textbox.
// tbResults.Text = reader.ReadLine();
}
fileStream.Close();
}
}
答案 0 :(得分:1)
“打开对话框”窗口是系统窗口。沙箱的Silverlight必须使用我认为的系统打开对话框。
换句话说,我认为这是不可能的。