<?xml version="1.0"?>
-<Border CornerRadius="0" Margin="0" BorderWidth="1" Fit="True">
- <HorizontalStack Name="hstack" Margin="0" Spacing="5">
- <Label Width="30" Name="labCpt" Text="55" Margin="1" TextAlignment="RightCenter"/>
+<Border CornerRadius="0" Margin="0" BorderWidth="1" Width="0" Height="-1">
+ <HorizontalStack Name="hstack" Margin="0" Spacing="5" Width="0" Height="-1">
+ <Label Width="0" Name="labCpt" Text="55" Margin="1" TextAlignment="RightCenter"/>
<VerticalStack Spacing="1" Name="vstack">
<Button Width="10" Height="8" MouseClick="onUp">
<Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>
\r
if ((layoutType & (int)LayoutingType.PositionChildren) > 0)\r
Interface.LayoutingQueue.Enqueue (LayoutingType.PositionChildren, this);\r
+ \r
}\r
public override void UpdateLayout (LayoutingType layoutType)\r
{ \r
- if (layoutType == LayoutingType.PositionChildren)\r
+ if (layoutType == LayoutingType.PositionChildren) {\r
+ //allow 1 child to have size to 0 if stack has fixed or streched size,\r
+ //this child will occupy remaining space\r
+ if (Orientation == Orientation.Horizontal) {\r
+ if (Width >= 0) {\r
+ GraphicObject[] gobjs = Children.Where (c => c.Width == 0).ToArray();\r
+ if (gobjs.Length > 1)\r
+ throw new Exception ("Only one child in stack may have size to stretched");\r
+ else if (gobjs.Length == 1) {\r
+ int sz = Children.Except (gobjs).Sum (g => g.Slot.Width);\r
+ if (sz < Slot.Width) {\r
+ gobjs [0].Slot.Width = Slot.Width - sz - Spacing;\r
+ int idx = Children.IndexOf (gobjs [0]);\r
+ if (idx > 0 && idx < Children.Count - 1)\r
+ gobjs [0].Slot.Width -= Spacing;\r
+\r
+ if (gobjs [0].LastSlots.Width != gobjs [0].Slot.Width) {\r
+ gobjs [0].bmp = null;\r
+ gobjs [0].LastSlots.Width = gobjs [0].Slot.Width;\r
+ }\r
+ }\r
+ }\r
+ } \r
+ } else {\r
+ if (Height >= 0) {\r
+ GraphicObject[] gobjs = Children.Where (c => c.Height == 0).ToArray();\r
+ if (gobjs.Length > 1)\r
+ throw new Exception ("Only one child in stack may have size to stretched");\r
+ else if (gobjs.Length == 1) {\r
+ int sz = Children.Except (gobjs).Sum (g => g.Slot.Height);\r
+ if (sz < Slot.Height) {\r
+ gobjs [0].Slot.Height = Slot.Height - sz;\r
+ int idx = Children.IndexOf (gobjs [0]);\r
+ if (idx > 0 && idx < Children.Count - 1)\r
+ gobjs [0].Slot.Height -= Spacing;\r
+ if (gobjs [0].LastSlots.Height != gobjs [0].Slot.Height) {\r
+ gobjs [0].bmp = null;\r
+ gobjs [0].LastSlots.Height = gobjs [0].Slot.Height;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ } \r
ComputeChildrenPositions ();\r
- else\r
+ }else\r
base.UpdateLayout(layoutType);\r
}\r
#endregion\r