Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ADDON : different shape to a button (triangle)

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

    ADDON : different shape to a button (triangle)

    how can I create a different style for a button to have it in a shape of a triangle.
    tried to do this that didnt work. I get a blank window
    please advise.
    (not an expert developer... )

    Code:
    class CustomTriangleButton : Button
    {
        public CustomTriangleButton()
        {
          System.Windows.Shapes.Path trianglePath = new System.Windows.Shapes.Path();
    
            trianglePath.Fill = Brushes.Black;
    
            trianglePath.Data = Geometry.Parse("M0,0 L0,20 L20,10 Z");
    
            Content = new Grid
    
            {
    
                Children =
    
                {
    
                    trianglePath,
    
                    new TextBlock 
    
                    {
    
                        Text = "Click Me",
    
                        HorizontalAlignment = HorizontalAlignment.Center,
    
                        VerticalAlignment = VerticalAlignment.Center
    
                    }
    
                }
    
            };
    
        }
    
    }
    ​
    and then in the tab grid this:
    Code:
    CustomTriangleButton customButton = new CustomTriangleButton()
    
    customButton.Content = customButton;
    
    customButton.Click += CancelStopOrdersButton_Click;
    
    Grid.SetRow(customButton, TotalNumberofCellsInGrid);
    
    Grid.SetColumn(customButton, 1);
    
    grid.Children.Add(customButton);
    
    
    ​
    Last edited by dadarara; 12-18-2023, 01:22 AM.

    #2
    Hello dadarara,

    Thank you for your post.

    The shape of a button is a general C# concept that has to do with WPF modifications and is not specific to NinjaTrader. Since this topic goes beyond the support offered by NinjaTrader, you will likely need to seek out third-party resources for more information on how to create triangle-shaped buttons. 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 our NinjaTrader Ecosystem team to follow up with you with 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.

    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X