简体   繁体   中英

How to know the current color of the OS?

I would like to edit a button since a toolbar, but I realized when I was trying to edit button style, I noticed that the current SolidColorBrushes are from PresentationFramework.Aero . I would like to get the SystemColor of the ToolBarButtonPressed .

Do I make myself clear? If not, please let me know.

在此处输入图片说明

I think you don't have access to these brushes because you don't know their resource key. These brushes are defined in resource file for aero theme and they are not visible in SystemColors .

It may be you don't really want to change the template of the toolbar button but restyle it a little bit. In that case you can base your style on the default toolbar button style and don't need to care about the current theme:

<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"
    BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
    <!--custom setters and triggers-->
</Style>

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