I am trying to create a button to control a bool which controls whether a drawing object is displayed or not. Within OnBarUpdate, I have drawing objects wrapped inside a bool condition. This bool is currently controlled by user input via properties checkbox.
I would like to change that to being button controlled on the chart. I have created the button and the bool cycles true/false when the button is clicked, verified by print statement. However, the drawing object contained in that bool condition wrapper is not cycling on/off.
protected override void OnBarUpdate()
{
if (devButtonClicked)
{
HistDevs = true;
}
if (!devButtonClicked)
{
HistDevs= false;
}
if (HistDevs)
{
...Draw stuff
}
}
private void OnButtonClick(object sender, RoutedEventArgs rea)
{
System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
if (button == devButton && button.Name == "DevButton" && button.Content == "HideDevs")
{
if (!HistDevs)
devButtonClicked = true;
if (HistDevs)
devButtonClicked = false;
return;
}
}

Comment