TextBox selection highlight color and color

I am creating a TextBox control for a universal application (Windows and Windows Phone). I found that the color of the selection can be set by the "SelectionHighlightColor" property (blue in the image). But somehow the choice of brackets seems to preserve the color accent of the system (green in my case):

enter image description here

How to set the color of the brackets or redefine the color of the accent?

Update:

I tried to override a lot of brushes and theme colors, for example:

((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = Color.FromArgb(0xFF, 0x00, 0x00, 0xFF); 

and

 (Resources["PhoneAccentColor"]) = Color.FromArgb(0xFF, 0x00, 0xFF, 0xFF); 

It really redefines emphasis, but nothing affects the brackets. They are still green ...

+6
source share
2 answers

You should be able to add a new resource to your application. Then you just refer to it.

 <Application.Resources> <SolidColorBrush x:Key="AppAccentBrush" Color="#012345"/> </Application.Resources> 

Then you link to this page:

 <TextBlock Text="Custom Accent" Style="{StaticResource PhoneTextNormalStyle}" Foreground="{StaticResource AppAccentBrush}"/> 

You can also check this out. Although it is French, it has quite a lot of useful content for this purpose. Hope this helps.

0
source

Have you tried the caretbrush property for text fields:

An example of the XAML attribute is as follows:

 <TextBox CaretBrush="colorString"/> 

See the documentation below for future reference.

Link: Text Documentation

EDIT:

As you already mentioned, the text box you use is different from the one I checked that the universal application no longer uses the CaretBrush property: Windows Phone 8.1 (Silverlight) and Windows Phone 8.1

Take a look at this note:

Note: a deleted type or member does not necessarily mean that it is no longer available. A remote type may indicate that the type has been moved to another namespace or assembly that has not been taken into account. The deleted item can still be accessed in the base class.

The CaretBrush property is available in the System.Windows.Controls namespace.

-1
source

Source: https://habr.com/ru/post/977064/


All Articles