Sunday, August 30, 2009

Default Focus Behavior

I would love to share with you guys about Default Focus Behavior which I just created an hour ago because I thought this behavior would be very handy.

With this behavior, we would be able to set focus to any controls when we trigger any control events.

For example, whenever we click the button, we want to textbox got focused, or when we select the Option 1 for the very first time, the textbox will get focused as below image

defaultfocusbehavior_demo

Click the icon below for the source code



Hopes this helpful :)Technorati Tags:

Saturday, August 29, 2009

TextWraping in Silverlight

Just a little thing I came across when I am trying to set TextWraping property for a TextBox, but the text doesn't seem to be wrapped. Then I realized if the TextBox is setting with TextWraping greater than 1, the text won't be wrapped. Just a little thing to keep in mind :)

Thursday, August 20, 2009

Datagrid Missing Binding Error

I have run into this silly mistake, and it took me 2 hours to figure it out :(

I am writing it down here for my own reference, and if you ever ran into this problem, hope that this can help you fix your problem quickly.

The problem is I had a datagrid column with the Header but not the Binding, for example


This will cause the below error at runtime

Datagrid Missing Binding Error

To fix it, all I had to do is to put the Binding in it



Hope this helps

Monday, August 17, 2009

UpperCase Behavior

I was asked to create a TextBox input which has only UpperCase letters. After a bit of research, I have found this article which has inspired me to come up with this solution. As we all know that Behavior is a cool stuff in Silverlight 3, so I decided to use the concept from that article and create a Behavior which detects all the key and uppercase it. Feel free to download the source code and have a play with it.