c# WPF Change the check color of a CheckBox -


 <checkbox background="white" ischecked="{binding isselected, updatesourcetrigger=propertychanged}"/> 

i need change color of check. figured forground did since background changed background color no avail.

any ideas? surly there way directly change check color. tried googling solution found make own checkbox class.

where property change checkbox check color?

i found 1 answer with

    <path visibility="collapsed"       width="7"       height="7"       x:name="checkmark"       snapstodevicepixels="false"       strokethickness="2"       data="m 0 0 l 7 7 m 0 7 l 7 0">   <path.stroke>     <solidcolorbrush color="{dynamicresource glyphcolor}" />   </path.stroke> </path> 

but not work since cannot add child element. if worked, change much. want white background black checkmark. grey on grey terrible looking. isn't there built in way change color?

this annoying sledgehammer said bullet bs. basically, brushes hardcoded, there isn't easy solution. being said, here quick 1 line hack. doesn't break animations on machine.

though, sledgehammer pointed out, there several different states. i'll leave override ones need. basic check.

typeof(bulletchrome).getruntimefields().where(f => f.name == "_commoncheckmarkfill").first().setvalue(null, new solidcolorbrush(colors.yellow)); 

you're going have reference presentationframework.aero , include using microsoft.windows.themes;

example on machine

its worth pointing out, affect every checkbox, , potentially (depending on brushes overwrite) radiobutton, depending on needs, ymmv. asked for.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -