posted on Monday, May 07, 2007 11:42 AM by stombeur

Silverlight Alpha 1.1 TextBox

I managed to extend the SilverLightControls samples that are part of the SDK to make a TextBox.

At the moment it's pretty barebones. It has a moving cursor (or is it a caret, I never know), you click on it to focus, you can type text into it, you can get/set text with the Text property and that's about it.

It still needs:
- position the cursor
- resizing
- move the start of the text to the left if it becomes too long for the box
- selecting text
- enable Ctrl-V and Ctrl-C etc...
- enable text styles
- ...

How to make it work:
1. include the files in the SilverLightControls project in the SDK (freely downloadable from silverlight.net)
2. make sure the xaml files are 'embedded resources'
3. replace Page.xaml and Page.xaml.cs in the TestApp project (also in the SDK) with the ones below
4. rebuild TestApp and run
5. click on the textboxes to type
6. click on submit

The code for the controls

Replacement Page.xaml

Replacement Page.xaml.cs

Comments