Share via


SilverLight Textbox control

I beat my head against the wall for quite some time on this one.  Silverlight is great, but what do you do when you need to capture some kind of user input?  You have a couple of choices, you can either overlay HTML controls on top of your SliverLight control (https://silverlight.net/Learn/learnvideo.aspx?video=105) or you can overlay ASP.Net controls on top of that same Silverlight control (https://silverlight.net/Learn/learnvideo.aspx?video=122).  Now there is a third option, provided by Dave Relyea @ Microsoft.  He wrote a TextBox control (and a bunch of others) that I would highly recommend if you want to capture data inside of Silverlight.

 https://blogs.msdn.com/devdave/archive/2007/05/17/silverlight-1-1-alpha-layout-system-and-controls-framework.aspx

You can find a working sample of the controls he created here:

https://www.simplegeek.com/mharsh/layout/

I am just now getting my hands dirty with these controls and will report back once I find out more.

 EDIT:  Ok, I had to perform a couple of tricks to get these to work with my application.  Fortunately, Dave was extremely helpful.

  • First, make sure the XAML resources have the same namespace as your project.  That means in all of the constructors of your XAML files you will need to change agLayoutDemo.Controls.*.xaml to your namespace (younamespace.Controls.*.xaml).
  • Second, If you put the controls in a folder inside of VS Orcas (and make sure you use Orcas), then you will need to change the build action on the XAML files from "Silverlight Page" to "Embedded Resource".  Note that it will only be a problem if you are not in the root of the project.

HTH.