With the release of VS2010 and .NET 4.0, some new changes have been introduced in WPF 4.0 for providing UX. WPF 4.0 TextBox control has introduced new properties for text selection as listed below:
- SelectionBrush - This defines the brush when the text in the textbox is selected.
- SelectionOpacity - This defines the opacity of the of the selection color during highlighting the text.
In the following XAML I have used the textbox with some text inside it. The SelectionBrush is set to the ‘LightBlue’ and the SelectionOpacity is set to 0.6 for transparency.
<TextBox Height="170"
HorizontalAlignment="Left" Margin="46,43,0,0"
Name="txtDisplay" VerticalAlignment="Top" Width="336"
Text="Windows Presentation Foundation 4.0" FontSize="18"
SelectionBrush="LightBlue" SelectionOpacity="0.6" Foreground="Black"/>
When you run the application and select the text in the textbox, the following result will be displayed.
Tweet
No comments:
Post a Comment