Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by lightsun47, Today, 03:51 PM
    0 responses
    4 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    8 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    44 views
    0 likes
    Last Post futtrader  
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    13 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    9 views
    0 likes
    Last Post port119
    by port119
     
    Working...
    X