Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Make Custom Drawing Tool Icon Turn White on Hover?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Make Custom Drawing Tool Icon Turn White on Hover?

    Hi all,
    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

    #2
    Hello Jan,

    This is an advanced C# concept.

    There can be limitations using unsupported code and advanced C# concepts in a NinjaScript, so your mileage may vary. As of now, we do not have any examples that can be used to navigate that path.

    This thread will remain open for any community members that would like to provide direction or a custom sample of this advanced c# concept.
    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.​
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by samish18, Today, 09:30 PM
    0 responses
    6 views
    0 likes
    Last Post samish18  
    Started by Super Bardock, Yesterday, 11:52 AM
    2 responses
    19 views
    0 likes
    Last Post Super Bardock  
    Started by raysinred, 04-06-2025, 01:52 PM
    16 responses
    139 views
    0 likes
    Last Post raysinred  
    Started by iantriestrading, Yesterday, 01:39 PM
    5 responses
    28 views
    0 likes
    Last Post iantriestrading  
    Started by trendisyourfriend, 05-25-2023, 09:54 AM
    10 responses
    170 views
    0 likes
    Last Post Curerious  
    Working...
    X