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.

Comments

  • Anonymous
    May 26, 2007
    Thanks, I spent a ton of time trying to get this to work in my project.  I tried changing all the namespaces, but GetManifestResourceStream still returned null every single time.  And I wasn't sure that I even needed to change the namespaces, I was just trying stuff to get it to work.I just followed your instructions and got it working in about 5 minutes--perfect!  Thanks a lot!
  • Anonymous
    September 05, 2007
    The comment has been removed
  • Anonymous
    September 05, 2007
    Disregard my last post.  I finally figured it out...I had changed the Visiblity from Hidden to Collapsed (must have been a change in silverlight) everywhere but the textbox.xaml file.  Once I made the change there everything worked.Praise the Lord!  Now I can go get some sleep. :-)
  • Anonymous
    December 22, 2007
    I would like SilverLight Controls the same way as I'm using Orcas Controls on a Windows Form.  Please give us this new capability else not a lot of programmer will use SilverLight.I tell you, we already have so much to do else then doing a little of this and that and put this here and place this there and move it like that, rename it, etc..etc...we don't want to play with all kind of unnecessary tricky way to have a SilverLight control and we don't want to have to PAY again and again to have controls like TELERIK for instence...Ahhhhhhhh Santan, Comon, we're egerly waiting for SilverLight basic Controls available in Blend.  Unfortunatly, Blend December preview doesn't even offer this... Ahh well !
  • Anonymous
    April 20, 2008
    Mein Kollege Bastian Moldenhauer hat sich auf meine Bitte mit der Silverlight Alpha auseinandergesetzt