How to change TextAlignment by code? LightSwitch 2013

100 views Asked by At

I'm building a program in LightSwitch 2013 (Visual Studio 2013). I have a textbox (that is ReadOnly) that it's text alignment is fixed to my language by default (not to English). I wrote a code in my program that check if the textbox has my language or English. I want to change the textbox alignment to be fixed to English when the user wrote something in English. How do I do that in LightSwitch? Can I do that?

Just to make clear, this text box has text all the time - It's for my View Screen. In my question i don't talk about the situation when the user typing in a text box.

1

There are 1 answers

1
Kris On BEST ANSWER

As far as i know the LightSwitch 2013 HTML contentItem.horizontalAlignment field is Read-Only.

I don't know any LightSwitch methods that allow you to change this at run time. I'm sure it can be done in Javascript or JQuery.

You could create 2x TextBox controls and set one to align left, and the other to right and toggle their visibilty.

Alternatively you could create a Custom Control and render it using JQueryMobile (data-mini='true') but this would require far more effort setting and updating it's value.