Silverlight RTL Support - silverlight

I know Silverlight 4 added support for RTL languages through the FlowDirection property.
Being new to RTL I just want to make sure I understand what should happen when I set the FlowDirection property. I noticed that the text alignment for the TextBoxes are now right aligned and the whole UI basically mirrors itself by switching everything that was on the left over to the right. So this all seems to be working fine. However, when entering text in a Textbox, surely the text should complete from right to left now as well. So I if enter the word 'run' in a TextBox with FlowDirection set to RTL, then surely it should read 'nur' and not 'run'? Is my understanding correct, but currently the TextBox still displays it as 'run' even thought it is right-aligned in the control itself.

The RTL-ness of the text will be automatically by the unicode text itself. So if you chuck in some Arabic text into the TextBox, it'll be in the correct direction (RTL), regardless of whether the FlowDirection is set or not. The FlowDirection is just for mirroring the UI, it's not about changing the text. Apparently there's also some clever special treatment of colons.
So basically: yup, that's correct, working as intended.

Related

Mnemonics in ComboBox control

I have inherited a ComboBox control mainly to create a different visual look. However, this behaviour where the ampersand is being turned into a shortcut (letter after is underlined) in the text field of the control has me stumped. I know this feature exists on Label controls and it can be turned off but here? How can I turn it off?
I have found the culprit. I've used Graphics.DrawString for drawing items and TextRenderer.DrawText for textbox portion of control. The former by default doesn't draw mnemonics and the latter one does. In both methods this feature can be turned on or off.

Force ClearType text rendering in a popup

I know that WPF disables ClearType text rendering if it is in doubt whether the background is fully opaque. There's the RenderOptions.ClearTypeHint attached property that can be used to assure WPF that it's safe to use ClearType rendering in a certain subtree. This is what I used on my popup with an opaque background and a shadow around it. But it has no effect. The text always shows up with greyscale smoothing.
I tried the official documentation of this property, and its example in Kaxaml. They say the third text should use ClearType but may show wrong rendering. But it's wrong! The third text is also just greyscale.
Also when inspecting the default control template for a ComboBox popup, they don't do anything else but it works fine in their control. I want the same rendering performance in my customised popup control.
Is there a way to definitely, finally force WPF to use ClearType text rendering in some place? I don't like its stupid smartness that prevents the right things from happening because they might be unsafe (but really are not).

wpf textbox caret

I'm trying to remove caret blinking from a textbox after the input is done. I've tried focusing another control programmatically and setting IsReadOnlyCaretVisible=false and IsReadOnly on mouseleave event but nothing helps. What should I do? The caret still remains there whatever I do...
That's very strange. The caret should go away when the focus changes, eg when you click out of the textbox. You can't use the old fashioned "HideCaret" WINAPI function, since it's not a standard Windows control - it's WPF.
This question addresses the OPPOSITE of your problem, since your problem isn't supposed to even happen, and the solution was a very simple line of code. Perhaps if you flip the logic around, or find out if your code is already doing this and disable that part - you can get the result you're looking for: WPF Textbox persist visible caret
Also, if you're using a recent version of WPF, you can probably reassign the brush that the caret uses.

WPF Mdi from codeplex richtextbox issue

this question is only for those who use the MDI from Codeplex.
I successfully implemented the mdi container and can add or remove child elements dinamically through my code.
My problem is that some of my custom controls (like UserControl) contain a few other controls (ex: TextBox, Buttons, ComboBox, etc), and every control works normally, EXCEPT for the RichTextBox!!!
The issue is that every time I input text in runtime mode, after each char input it automatically goes to another line.
Before you say that may be the way my custom control is built, be assured... it's not. I passed the control containing the richtextbox to another window and it worked normally.
Anyone has the same problem?? Or solution?? I know the codeplex version is still not fully finished but I'm hoping I'm the one doing something wrong...
Thanks
Found the issue. My RichTextBox Width Property was set to AUTO and for some reason (that is completely oblivious to me), it was what was causing the problem.
The solution is to give it a physical (a number rather than AUTO) value to it's Width property.
In my case, since my control has a TextBox just above the RichTextBox and they're supossed to be the same width, I've set my RichTextBox.Width = TextBox.ActualWidth. Note that I used ActualWidth and not width since the width property in my TextBox is also Auto, but the value returned by ActualWidth is a number.
Hope it helps someone :-)

Controlling the position of Silverlight textbox's caretbrush

I believe the cursor over a textbox is called a caretbrush.
There are times application is run without a keyboard/ mouse (eg: Kiosk), so I will put up a virtual keyboard for the user.
The virtual keyboard appends to the textbox programmatically.
When I focus on the textbox, irregardless of have any text in it, the caretbrush will always be at the leftmost position.
Is there anyway I can control the position of it?
If unable to do it, guess I just hide the caret brush, otherwise it looks abit confusing especially when u are at the 3rd character but the caretbrush shows on the 1st character.
I found the answer already.
txt1.SelectionStart=txt1.text.length
but txt1.SelectionStart=txt1.text.length-1 is only correct

Resources