I can create a one-click drawing tool button for a default Ninja Drawing Tool using a default Ninja Icons, no problem. For example, for Ninja default DrawRay I define the button using default Icons as:
if (!isToolBarButtonAdded && showRay) { btnRay = new System.Windows.Controls.Button { Content = NinjaTrader.Gui.Tools.Icons.DrawRay, }; btnRay.Click += btnRay_Click; chartWindow.MainMenu.Add(btnRay); }
However, If I use a text symbol instead of an Icon I must create a style to apply per Help information. Therefore, for using a Wingdings 3 font symbol I change the above script to:
if (!isToolBarButtonAdded && showRay) { Style btnStyle = new Style(); btnStyle.TargetType = typeof(System.Windows.Controls.Button); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.FontSizeProperty, 24.0)); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.FontFamilyProperty, new FontFamily("Wingdings 3"))); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.FontWeightProperty, FontWeights.Bold)); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.ForegroundProperty, Brushes.CornflowerBlue)); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.BackgroundProperty, Brushes.Transparent)); btnStyle.Setters.Add(new Setter(System.Windows.Controls.Button.IsEnabledProperty, true)); btnRay = new System.Windows.Controls.Button { Content = "*", Style = btnStyle, }; // "*" is the keyboard key for drawing symbol from the FontFamily btnRay.Click += btnHorizontalRay_Click; chartWindow.MainMenu.Add(btnRay); }
However, the issue I have is the button will not get activated by a mouse click.
I followed the "Using BitmapImage objects with Buttons" in Help section. Also, using padding and margin properties did not make a difference.
Am I missing anything?
Many thanks.
Comment