tags:

views:

28

answers:

3

I'm trying to add this Silverlight 4 control to my project. I went to the downloads page, and it's full of VS solutions/projects/.cs files. I'm new to Silverlight, and I don't really know how to get the control from that. Help?

Update: I tried following roufamatic's instructions. At this point, I was still unsure how to use the control, so I tried the following code:

        mpost.SilverlightSingleFileUpload.MainPage singleFileUpload = new mpost.SilverlightSingleFileUpload.MainPage();
        singleFileUpload.Width = singleFileUpload.Height = 100;

Unfortunately, the app crashes on the first of the above lines:

Could not load file or assembly 'mpost.SilverlightMultiFileUpload.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

What else can I try?

A: 
  1. Build it.
  2. Take the output dll and put in a directory in your own solution.
  3. Add a reference to the dll.
  4. right click on tool box
  5. click 'choose items'
  6. look on the silverlight tab
  7. mark the appropriate checkbox
BioBuckyBall
There were many dlls in the obj/release folder. I copied one that looked appropriate ("mpost.SilverlightSingleFileUpload") and pasted it into the project folder in Projects/MyProject. I added a reference, but I'm not sure what to do now. It's not showing up in the "Toolbox" tab.
Rosarch
I also "unblocked" it using the Properties menu in Windows Explorer, since it was downloaded from the internet.
Rosarch
@Rosarch see edit
BioBuckyBall
A: 

Assuming your project is a web application, you can add it to your project like so:

  1. Download the full source, including the project file.
  2. Add the Silverlight project to your solution.
  3. Open Properties on your web application and choose "Silverlight Application" on the left side.
  4. Click "Add" and choose the Silverlight project.

This dialog can also generate a test page which will get you some boilerplate HTML to embed the control in your own pages. You may also enable debugging so you can step through the code when the control is loaded in the browser.

roufamatic
I did this; however, VS complains that not all the dependencies/references of the added project can be found/loaded. Perhaps I did something wrong?
Rosarch
I checked out the zip. There's a sample web project in there called mpost.SilverlightMultiFileUploadWeb. That contains the XAP files in ClientBin along with some ASP.NET pages that embed the control. The control communicates with "HttpUploadHandler.ashx" to handle the upload itself. To get the basic scenario working you shouldn't need to write any C# code as you did in your update above. See if you can get the sample web project working and then tweak it to meet your needs. Check web.config in that project as that's likely to contain any and all config options. Good luck!
roufamatic