Adding "+" and "-" labels on the chart trader panel

Hi,
I’m adding some additional buttons on the chart trader for order entries and want to add a tick offset feature where hitting the + button increases the tick offset and - decreases it. The functionality currently works but instead of showing + and - on the panel, it shows as a left bracket ’ [ '.

  1. Why do WPF Button controls in NinjaScript show bracket characters [ instead of the actual text content like “+” and “-”?
  2. Is there a specific font or styling needed for button text to display correctly in NinjaTrader’s WPF environment?

Here is an excerpt of the code i’m using for the + sign as example:

// Create offset up button
btnOffsetUp = new System.Windows.Controls.Button
{
Content = “+”,
Background = BrushOffsetButton,
BorderBrush = BrushButtonBorder,
BorderThickness = new Thickness(1),
FontSize = 16,
FontWeight = FontWeights.Bold,
Width = 28,
Height = 22,
Padding = new Thickness(0),
Margin = new Thickness(0, 0, 2, 0),
Focusable = false,
Cursor = Cursors.Hand,
Foreground = Brushes.Black
};
btnOffsetUp.Click += OffsetUpButton_Click;
btnOffsetUp.IsEnabled = false;

System.Windows.Controls.Grid.SetRow(btnOffsetUp, 2);
System.Windows.Controls.Grid.SetColumn(btnOffsetUp, 3);

image

Thank you for the help.

That’s a strange one. My best guess would be the font family the button is using is mapping the “+” / “-” in an unexpected way. As a quick test you could try setting it something standard / generic and see if the problem persists. If that doesn’t solve it, I would look for inherited styling overrides like ContentTemplate that might be interfering.

button.FontFamily = new FontFamily("Arial");

Edit: After looking at your image a little closer, I don’t think we’re seeing the left bracket “[”. I think that’s the border and there is insufficient space for the rest of the button.

I don’t have this issue when rendering WPF buttons on the chart panel using the Default Font. (Montserrat)

hmm. I’ve expanded the panel to see if it would make a difference but it stays the same. Thanks for the suggestion.

Expanding the panel wouldn’t change anything. You have a hard coded width of 28 for your buttons. Look at the size of the [ shape. Notice it’s the same size as the input field border, and way bigger than the font size. I’m virtually certain that is the problem.