This is a migrated thread and some comments may be shown as answers.

Watermark text alignment

2 Answers 203 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Vadimir
Top achievements
Rank 1
Vadimir asked on 29 Jan 2014, 11:05 AM
Hi,

I'm using the version Q3 2013 SP1 (2013.3.1204.40).
Is it possible to make the watermark text, e.g. "Type a name" in the attached picture, right alignment?
Thanks.

Regards,
Gong

2 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 29 Jan 2014, 01:53 PM
Hi Gong,

You could easily achieve the desired by finding the WatermarkTextBox inside of the AutoCompleteBox and setting its HorizontalContentAlignment property to Right. You could do that when Loaded event of the AutoCompleteBox is fired, the handler should like as follows:

private void auto_Loaded(object sender, RoutedEventArgs e)
{
    var watermark = this.auto.ChildrenOfType<RadWatermarkTextBox>().First() as RadWatermarkTextBox;
    watermark.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
}

However this will cause the text input when typing to also go on the right side, so what you can do is to set it back to Left on GotFocus event of the AutoComplete and set it back to Right on LostFocus. I have prepared and attached a sample project which demonstrates the exact approach.

Hope this helps.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Vadimir
Top achievements
Rank 1
answered on 29 Jan 2014, 02:16 PM
Hi Kalin,
Thanks. This is exactly what I need.
Regards,
Gong
Tags
AutoCompleteBox
Asked by
Vadimir
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Vadimir
Top achievements
Rank 1
Share this question
or