6 Answers, 1 is accepted
0
Hi Doug,
You can use the TextAlignment property to set both text and watermark's alignment to Left, Right, Center or Justify.
Regards,
Todor
the Telerik team
You can use the TextAlignment property to set both text and watermark's alignment to Left, Right, Center or Justify.
Regards,
Todor
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Doug
Top achievements
Rank 1
answered on 16 Jul 2012, 09:13 AM
Hi Todor
The TextAlignment property only changes the alignment of the input text but not the watermark. Also I want the text to be aligned to left and the watermark aligned to the center.
The TextAlignment property only changes the alignment of the input text but not the watermark. Also I want the text to be aligned to left and the watermark aligned to the center.
0
Hello Doug,
Please accept my apologies for the misleading information in my previous post.
With our next internal build, we will make the alignment of the watermark dependent on the TextAlignment property.
However, if you want to have the watermark and the text with different TextAlignment, you will have to edit the control template of RadTextBox and set the desired alignment to the PART_Watermark.
Let me know if you need additional assistance.
Kind regards,
Todor
the Telerik team
Please accept my apologies for the misleading information in my previous post.
With our next internal build, we will make the alignment of the watermark dependent on the TextAlignment property.
However, if you want to have the watermark and the text with different TextAlignment, you will have to edit the control template of RadTextBox and set the desired alignment to the PART_Watermark.
Let me know if you need additional assistance.
Kind regards,
Todor
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Doug
Top achievements
Rank 1
answered on 16 Jul 2012, 12:44 PM
Hi
"However, if you want to have the watermark and the text with different TextAlignment, you will have to edit the control template of RadTextBox and set the desired alignment to the PART_Watermark."
That is exactly what I would like to do, but I don't know how to apply a style to it.
it wont accept this:
<Style x:Key="waterMarkStyle" TargetType="ContentControl">
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="FontSize" Value="25"/>
<Setter Property="Foreground" Value="Black"/>
</Style>
I would like help with that.
Thanks in advance
Best Regards
"However, if you want to have the watermark and the text with different TextAlignment, you will have to edit the control template of RadTextBox and set the desired alignment to the PART_Watermark."
That is exactly what I would like to do, but I don't know how to apply a style to it.
it wont accept this:
<Style x:Key="waterMarkStyle" TargetType="ContentControl">
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="FontSize" Value="25"/>
<Setter Property="Foreground" Value="Black"/>
</Style>
I would like help with that.
Thanks in advance
Best Regards
0
Accepted
Hi Doug,
I hope this information helps. Greetings,
Todor
the Telerik team
The watermark is not a ContentControl, it is a TextBlock. What I mean is to edit the ControlTemplate of RadTextBox. The easiest way to get the original template is by right-clicking the control in Blend and then selecting Edit Template -> Edit a Copy. Another way to achieve the alignment is to use the ElementTreeHelper class and get the desired element:
TextBlock watermark = ElementTreeHelper.FindVisualDescendant<TextBlock>(
this
.textBox,
(t) =>
{
if
(t
as
TextBlock !=
null
&& (t
as
TextBlock).Name ==
"PART_Watermark"
)
{
return
true
;
}
return
false
;
});
watermark.TextAlignment = TextAlignment.Center;
I hope this information helps. Greetings,
Todor
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Doug
Top achievements
Rank 1
answered on 17 Jul 2012, 07:16 AM
Thank you for your help, that helped me!
Best Regards Doug
Best Regards Doug