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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X