<Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
<Label Text="{../../Caption}" Height="80" Width="200"/>
</HorizontalStack>-->
-<!--<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
<Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
<Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
-</HorizontalStack>-->
-<GraphicObject Text="{../Caption}" Height="20" Width="{../TemplatedWidth}"/>
\ No newline at end of file
+</HorizontalStack>
+<!--<GraphicObject Text="{../Caption}" Height="20" Width="{../TemplatedWidth}"/>-->
\ No newline at end of file
<RadioButton Caption="Radio 1" Background="SkyBlue" Width="0"/>
</VerticalStack>
</GroupBox>
+ <HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5" Background="SkyBlue">
+<!-- <VerticalStack Height="-1" Width="-1" >
+ <RadioButton Caption="Radio 2" IsChecked="true" />
+ <RadioButton Caption="Radio 3" />
+ </VerticalStack>
+ <VerticalStack Height="-1" Width="-1" >
+ <RadioButton Caption="Radio 2" IsChecked="true" />
+ <RadioButton Caption="Radio 3" />
+ </VerticalStack>-->
+ <RadioButton Width="80" Height="-1" Caption="Radio 2" IsChecked="true" />
+ <GraphicObject Width="0"/>
+ <RadioButton Width="80" Height="-1" Caption="Radio 3" />
+ </HorizontalStack>
+
<HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5"
Background="vgradient|0:White|0,1:SteelBlue|0,9:SteelBlue|1:Transparent">
<CheckBox Height="-1" Width="80"/>
Size tmp = new Size ();
if (Orientation == Orientation.Horizontal) {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
tmp.Width += c.Slot.Width + Spacing;
tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
}
if (tmp.Width > 0)
tmp.Width -= Spacing;
} else {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
tmp.Height += c.Slot.Height + Spacing;
}
#endif
int d = 0;
if (Orientation == Orientation.Horizontal) {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
c.Slot.X = d;
d += c.Slot.Width + Spacing;
- if (c.Height != 0)
- c.RegisterForLayouting (LayoutingType.Y);
+ c.RegisterForLayouting (LayoutingType.Y);
}
} else {
- foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
c.Slot.Y = d;
d += c.Slot.Height + Spacing;
- if (c.Width != 0)
- c.RegisterForLayouting (LayoutingType.X);
+ c.RegisterForLayouting (LayoutingType.X);
}
}
bmp = null;
{
RegisteredLayoutings &= (~layoutType);
+ LayoutingType childSizeToCheck;
+ if (Orientation == Orientation.Horizontal)
+ childSizeToCheck = LayoutingType.Width;
+ else
+ childSizeToCheck = LayoutingType.Height;
+
+ foreach (GraphicObject g in Children) {
+ if (!g.Visible)
+ continue;
+ if (g.RegisteredLayoutings.HasFlag (childSizeToCheck))
+ return false;
+ }
+
if (layoutType == LayoutingType.PositionChildren) {
//allow 1 child to have size to 0 if stack has fixed or streched size,
//this child will occupy remaining space
return base.UpdateLayout(layoutType);
}
- public override void OnLayoutChanges (LayoutingType layoutType)
- {
- base.OnLayoutChanges (layoutType);
-
- if (Orientation == Orientation.Horizontal){
- if(layoutType == LayoutingType.Width)
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- }else if (layoutType == LayoutingType.Height)
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- }
+// public override void OnLayoutChanges (LayoutingType layoutType)
+// {
+// base.OnLayoutChanges (layoutType);
+//
+// if (Orientation == Orientation.Horizontal){
+// if(layoutType == LayoutingType.Width)
+// this.RegisterForLayouting (LayoutingType.PositionChildren);
+// }else if (layoutType == LayoutingType.Height)
+// this.RegisterForLayouting (LayoutingType.PositionChildren);
+// }
public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
{
base.OnChildLayoutChanges (sender, arg);
#endif
switch (layoutType) {
- case LayoutingType.Width:
- if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
- this.RegisterForLayouting (LayoutingType.X);
+ case LayoutingType.Width:
+ this.RegisterForLayouting (LayoutingType.X);
break;
case LayoutingType.Height:
- if (Height != 0 && Parent.getBounds().Height >=0) //update position in parent
- this.RegisterForLayouting (LayoutingType.Y);
+ this.RegisterForLayouting (LayoutingType.Y);
break;
}
LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
//position smaller objects in group when group size is fit
switch (layoutType) {
case LayoutingType.Width:
- foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
- if (c.getBounds ().Width == 0)
- c.RegisterForLayouting (LayoutingType.Width);
- else
- c.RegisterForLayouting (LayoutingType.X);
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
}
break;
case LayoutingType.Height:
- foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
- if (c.getBounds ().Height == 0)
- c.RegisterForLayouting (LayoutingType.Height);
- else
- c.RegisterForLayouting (LayoutingType.Y);
- }
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height); }
break;
}
}
switch (layoutType) {
case LayoutingType.Width:
if (child != null) {
- if (child.getBounds ().Width == 0)
- child.RegisterForLayouting (LayoutingType.Width);
- else
- child.RegisterForLayouting (LayoutingType.X);
+ if (child.Visible)
+ child.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
}
break;
case LayoutingType.Height:
if (child != null) {
- if (child.getBounds ().Height == 0)
- child.RegisterForLayouting (LayoutingType.Height);
- else
- child.RegisterForLayouting (LayoutingType.Y);
+ if (child.Visible)
+ child.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
}
break;
}