0

Stupid question I know but how do i create one? All i need it to do is open up a dialog box and populate the text box next to it

ivordesign
  • 325
  • 1
  • 6
  • 16

2 Answers2

2

If I understand correctly you are asking only about putting a user-selected filename into a TextBox control next to a button. You are NOT asking about the actual uploading of the file. If this is correct, then my answer is that you can do this:

        OpenFileDialog dlg = new OpenFileDialog();
        dlg.Multiselect = false;
        if (dlg.ShowDialog() == true)
        {
            yourTextBox.Text = dlg.File.Name;
            // Read stream of data from file, etc.
        } 

You can't show the full path which would have been available via dlg.File.FullName due to security restrictions in Silverlight.

Clay Fowler
  • 2,059
  • 13
  • 15
1

You need to use the OpenFileDialog (silverlight 2.0). There are plenty examples kicking around or I am a big fan of Video Demo's example 2.

cgreeno
  • 31,943
  • 7
  • 66
  • 87