Parent StackPanel is not auto resized when child StackPanel.IsVisible=false (cTrader v5.0.21, Algo v1.0.9)
Parent StackPanel is not auto resized when child StackPanel.IsVisible=false (cTrader v5.0.21, Algo v1.0.9)
18 May 2024, 17:29
Hi Team,
Recently noticed when child StackPanel.IsVisible=false then parent container (e.g. StackPanel) still holds child stackpanel space while in ctrader v4 it was automatically auto resized like with property MaxWidth = 0.
Here in screenshot it clearly visible that Border should be auto resized to just button btnShowHide (it was with cTrader v4) when stackpanel.isVisible=false
Results:
- Before (StackPanel.IsVisible=true)
- After(StackPanel.IsVisible=false)
- Expected: border should auto resize to btnShowHide as there is nothing visible (thats how it was working with ctrader v4)
SourceCode
using System;
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None, AddIndicators = true)]
public class cBotTest : Robot
{
Canvas canvasTopMost = new();
Canvas canvasMain = new() { Top = 10, Left = 10 };
Border border = new() { BorderThickness = 1, BorderColor = Color.White};
StackPanel stackHmain = new() { Orientation = Orientation.Horizontal };
StackPanel stackHchild = new() { Orientation = Orientation.Horizontal };
Button btnShowHide = new() { Text = "btnShowHide", };
Button btnChild1 = new() { Text = "btnChild 1", };
Button btnChild2 = new() { Text = "btnChild 2", };
Button btnChild3 = new() { Text = "btnChild 3", };
protected override void OnStart()
{
Chart.AddControl(canvasTopMost);
canvasTopMost.AddChild(canvasMain);
canvasMain.AddChild(border);
border.Child = stackHmain;
stackHmain.AddChild(btnShowHide);
stackHmain.AddChild(stackHchild);
btnShowHide.Click += e => { stackHchild.IsVisible = !stackHchild.IsVisible; };
stackHchild.AddChild(btnChild1);
stackHchild.AddChild(btnChild2);
stackHchild.AddChild(btnChild3);
}
protected override void OnTick()
{
}
protected override void OnStop()
{
}
}
}
Replies
prihod007
21 May 2024, 06:10
RE: Parent StackPanel is not auto resized when child StackPanel.IsVisible=false (cTrader v5.0.21, Algo v1.0.9)
PanagiotisCharalampous said:
Hi there,
Thank you for reporting this issue. We will resolve this in an upcoming update.
Best regards,
Panagiotis
I support you, this problem is relevant to me too
@prihod007
PanagiotisCharalampous
20 May 2024, 10:02
Hi there,
Thank you for reporting this issue. We will resolve this in an upcoming update.
Best regards,
Panagiotis
@PanagiotisCharalampous