Welcome to MSDN Blogs Sign in | Join | Help

Chad Brooks Web Log

Microsoft and architecture
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 (http://silverlight.net/Learn/learnvideo.aspx?video=105) or you can overlay ASP.Net controls on top of that same Silverlight control (http://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.

 http://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:

http://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.

Posted: Thursday, May 24, 2007 10:32 PM by chabrook
Filed under:

Comments

jm47 said:

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!

# May 26, 2007 2:07 PM

Steve Johnson said:

Hi Chad,

Is there any particular setup I need to do to make this work?  I tried just using the textbox zipped package but gave up after an hour of trying to get it to work.  Next up, I created a new silverlight project and copied everything over.

I still get ag_e_unknown_error, page.xaml, line 17, position 103, parser error which is nothing more than a Textbox definition in the xaml.

My goal is to download the sample, run it, and see what it looks like -- I had no idea I would have this much trouble...

Any advice would be much appreciated!  Thanks!!

btw, I followed the instructions above.

# September 6, 2007 12:25 AM

Steve Johnson said:

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. :-)

# September 6, 2007 12:50 AM

Marc Roussel said:

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 !

# December 23, 2007 6:58 AM

XAML Blog said:

Mein Kollege Bastian Moldenhauer hat sich auf meine Bitte mit der Silverlight Alpha auseinandergesetzt

# April 21, 2008 7:16 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker