I'm creating a custom drawing tools with an Icon property using a Grid and Path (Fill set to FontActionBrush or a static color).
Native tools turn white on hover with a bluish background, but my custom icon only gets the background, not the white fill.
How can I make my icon dynamically turn white on hover like native tools, especially across light and dark skins? Is there a specific resource or style I should use?
Thanks!
My example code:
public override object Icon
{
get
{
Grid myCanvas = new Grid { Height = 16, Width = 16 }; System.Windows.Shapes.Path p = new System.Windows.Shapes.Path(); p.Fill = Application.Current.FindResource("FontActionBrush" ) as System.Windows.Media.Brush ?? Brushes.CornflowerBlue; p.Data = System.Windows.Media.Geometry.Parse("M7,2 H4.2 V0.5 H11.5 V2 H8.5 V4 H10.7 V5.5 H8.5 V7.4 H10.6 V8.9 H8.5 V10.8 H10.6 V12.3 H8.5 V14.2 H11.5 V15.7 H4.2 V14.2 H7 V12.3 H4.9 V10.8 H7 V8.9 H4.9 V7.4 H7 V5.5 H4.9 V4 H7 V2 Z"); myCanvas.Children.Add(p); return myCanvas;
}
}
Regards
Jan
ekedal.no
Comment