First of all, it as good time as any to remind everyone that Microsoft’s Silverlight 2.0 doesn’t support Right-To-Left (RTL) text writing. God knows why a solution that exists for over 15 years (the logical-visual solution for RTL languages) couldn’t be introduced into Silverlight, and as far as I know it’s not even planned for version 3.0 of SL, so all of you who are planning on writing applications in hebrew/arabic/… – beware !
There is a semi-solution today that supports RTL languages, why “Semi” you ask? Because unfortunately the control that supports RTL writing is a new control that encapsulates a text box and not a text box that was inherited to add support for RTL (By “support” I mean the visual-logical algorithm that MS overlooked) .
Why is that a problem you might ask? because some 3rd party controls have a TextBox as part of their template (for example, the AutoCompleteBox), and since the Bidi.TextBox is not of the same inheritance tree as the silverlight’s TextBox, it just doesn’t work.
What can we do about it? sometimes we can do a workaround for this problem:
1. Create a new duplicated template for the 3rd party control (oh glorious Blend).
2. Add a Bidi.TextBox control to your template
3. Hide the template’s textbox by setting it’s height to zero (You can try setting the visibility to collapsed, but I’ve noticed I didn’t get event thrown this way)
4. Apply Alex’s solution to binding of control properties and attach both Text properties (MS’s and Bidi’s)
5. Hope it work’s pretty enough…
Why isn’t it 100% proof? Because the 3rd party control might still set different properties of the original text box, such as foreground, background, selection etc., causing the Bidi.TextBox not to show all the effects you hoped to get by using the 3rd party control.
How does this relate to the SL Toolkit’s AutoCompleteBox – I’ve applied the above changes to the template and it worked, except for the problems mentioned above (you can see it when setting the IsTextCompletionEnabled property).
I myself am going to look for another autocomplete text box. If anyone has recommendations for an open-source control, I’d be happy to check it out.
P.S., I’ll be attending the Dev Academy tomorrow and I’ll be happy to share my experience in developing Hebrew LOB applications with SL 2. In case you don’t know what I look like - This is me.