Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set Menu and MenuItem background and foreground color when mouse over #2366

Closed
stanley8615 opened this issue Jul 7, 2021 · 6 comments
Labels
question Old items with this tag will be automatically closed.

Comments

@stanley8615
Copy link
Contributor

stanley8615 commented Jul 7, 2021

image
some control like Menu,MenuItem,ListBox,ListView,Datagrid ... background and foreground when mouse over, color is gary , how to set that colors by one time, not custom style(trigger) one by one, thanks

@Erapchu
Copy link
Contributor

Erapchu commented Jul 7, 2021

Hello!
If you want just set background color as gray, you can use a property "Background" for controls that you want.

@stanley8615
Copy link
Contributor Author

Hello!
If you want just set background color as gray, you can use a property "Background" for controls that you want.

Thanks
But that's not what I mean,I mean under “Mouse Over” ,like Highlight or Active color

@Keboo
Copy link
Member

Keboo commented Jul 7, 2021

@stanley8615 so you listed several controls up there. Each is going to have slightly different answers.

For Menu/MenuItems: These are not currently settable. They are controlled indirectly by the Foreground brush. This color than has an opacity set when the mouse is over.
ListBox/ListView: Similar story here. These are controlled by the Foreground. There is a bit of a hack I posted that manipulate the contents of the control template at runtime, but due to the triggers the opacity still applies.
DataGrid: You are in more luck here these are controlled by the theme brush MaterialDesignSelection. If you want to change the theme brush the docs are in the wiki or I have some samples online

@Keboo Keboo added the question Old items with this tag will be automatically closed. label Jul 7, 2021
@stanley8615
Copy link
Contributor Author

@stanley8615 so you listed several controls up there. Each is going to have slightly different answers.

For Menu/MenuItems: These are not currently settable. They are controlled indirectly by the Foreground brush. This color than has an opacity set when the mouse is over.
ListBox/ListView: Similar story here. These are controlled by the Foreground. There is a bit of a hack I posted that manipulate the contents of the control template at runtime, but due to the triggers the opacity still applies.
DataGrid: You are in more luck here these are controlled by the theme brush MaterialDesignSelection. If you want to change the theme brush the docs are in the wiki or I have some samples online

Thanks a lot ~!
by the way
image
I tried to change "SystemColors.XXXX" but not work, I think maybe link systemcolors is a options to solve this problem

@Keboo
Copy link
Member

Keboo commented Jul 7, 2021

I have added it to the list of changes to be considered for the 5.0.0 release. Having more control over individual colors is something that has been requested a lot so I want to spend some time going through the controls and providing that control to enable code like what you have above.

@stanley8615
Copy link
Contributor Author

This WPF UI is great, I look forward to your next version very much
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Old items with this tag will be automatically closed.
Projects
None yet
Development

No branches or pull requests

3 participants