i found a chart traders buttons example and want to adapt it to my needs.
The original script had 4 buttons, i removed one to have only 3,but for the last week, i couldn't figure out how to place the CANCEL ( button 3 ) right below the LONG and SHORT buttons, and make it as wide as the two upper buttons together.
Right now it looks like this :
Would some be so king and add missing lines or adjust the code so the CANCEL button gets below the other two? I'm not familiar with this yet.
Here's my code:
protected void InsertWPFControls()
{
chartTraderGrid = (Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader).Content as System.Windows.Controls.Grid;
chartTraderButtonsGrid = chartTraderGrid.Children[0] as System.Windows.Controls.Grid;
myButtonsGrid = new System.Windows.Controls.Grid();
chartTraderGrid.Children.Add(myButtonsGrid);
// add a new space for our custom grid below the ask and bid prices
chartTraderGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition() { Height = new GridLength(445) });
System.Windows.Controls.Grid.SetRow(myButtonsGrid, 270);
System.Windows.Controls.Grid.SetColumn(myButtonsGrid, 70);
chartTraderButtonsGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition() { Height = new GridLength(100) });
// spacer row
myButtonsGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition() { Height = new GridLength(31) });
myButtonsGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition() { Height = new GridLength(31) });
myButtonsGrid.ColumnDefinitions.Add(new System.Windows.Controls.ColumnDefinition() { Width = new GridLength(100) });
// spacer column
myButtonsGrid.ColumnDefinitions.Add(new System.Windows.Controls.ColumnDefinition() { Width = new GridLength(62) });
myButtonsGrid.ColumnDefinitions.Add(new System.Windows.Controls.ColumnDefinition() { Width = new GridLength(100) });
newButton1 = new System.Windows.Controls.Button()
{
Background = Brushes.Green,
BorderBrush = Brushes.DimGray,
Content = "LONG",
Height = 30
};
newButton2 = new System.Windows.Controls.Button()
{
Background = Brushes.Red,
BorderBrush = Brushes.DimGray,
Content = "SHORT",
Height = 30
};
newButton3 = new System.Windows.Controls.Button()
{
Background = Brushes.Gray,
BorderBrush = Brushes.DimGray,
Content = "CANCEL",
Height = 30
};
newButton1.Click += Button1Click;
System.Windows.Automation.AutomationProperties.SetAutomationId(newButton1, "newButton1");
chartTraderButtonsGrid.Children.Add(newButton1);
System.Windows.Controls.Grid.SetRow(newButton1, 12);
newButton2.Click += Button2Click;
System.Windows.Automation.AutomationProperties.SetAutomationId(newButton2, "newButton2");
chartTraderButtonsGrid.Children.Add(newButton2);
System.Windows.Controls.Grid.SetRow(newButton2, 12);
System.Windows.Controls.Grid.SetColumn(newButton2, 2);
newButton3.Click += Button3Click;
System.Windows.Automation.AutomationProperties.SetAutomationId(newButton3, "newButton3");
myButtonsGrid.Children.Add(newButton3);
System.Windows.Controls.Grid.SetColumn(newButton3, 0);
System.Windows.Controls.Grid.SetRow(newButton3, 12);
}
Thank you very much in advance!

Comment