简体   繁体   中英

Inactive list element style

In our WPF (.NET 4.5) application we would like to unify the look of standard list item selection. When active, the selected list/grid item is BLUE, but when the focus is lost, the color becomes GRAY. Is it possible to say somehow globally , that these color shouldn't change when focus is lost?

That's a recurrent one ! Put this

<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#FF3399FF"/>

In your application or main window resources.

Another way to achieve that is to define a Style that will be implicitly applied to all of your ListBoxItem, TreeViewItem etc. and will override the ControlTemplate to change the way the trigger that changes background colors works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM