PDA

View Full Version : [CLOSED] How should I rewrite this code in v1 to v2?



ViDom
Apr 23, 2013, 8:58 AM
Hi,

here's code from version v1:


Ext.Net.Container panelLeftContainer = new Ext.Net.Container();
panelLeftContainer.ID = "panelLeftContainer_" + this.ID;
Ext.Net.Container panelRightContainer = new Ext.Net.Container();
panelRightContainer.ID = "panelRightContainer_" + this.ID;
panelLeftContainer.AnchorHorizontal = "50%";
panelLeftContainer.MonitorResize = true;
panelRightContainer.AnchorHorizontal = "50%";
panelRightContainer.MonitorResize = true;
foreach (var p in panelList.Items)
{
if (panelList.Items.IndexOf(p) % 2 == 0)
panelLeftContainer.Items.Add(p);
else if (!panelRightContainer.Items.Contains(p))
{
panelRightContainer.Items.Add(p);
}
}

LayoutColumn layoutColumn1 = new LayoutColumn { ColumnWidth = 0.5M };
layoutColumn1.Items.Add(panelLeftContainer);
LayoutColumn layoutColumn2 = new LayoutColumn { ColumnWidth = 0.5M };
layoutColumn2.Items.Add(panelRightContainer);

ColumnLayout columnLayout = new ColumnLayout { ID="columnLayout_"+this.ID, Width = Unit.Pixel(800), Split = true, FitHeight = false, ColumnWidth = 0.5 };
columnLayout.Columns.Add(layoutColumn1);
columnLayout.Columns.Add(layoutColumn2);
this.AnchorHorizontal = "100%";
this.MonitorResize = true;
this.Items.Add(columnLayout);//in this case 'this' is a container control

Daniil
Apr 23, 2013, 10:40 AM
Hi @ViDom,

You should use a Container's Layout or LayoutConfig property instead of the ColumnLayout control.

Also please forget about a LayoutColumn.

Each a Container's items (a component added to a Container's Items collection) represents a column. For example, you should set up the ColumnWidth property direct for a Container's item.

This example demonstrates the structure I am talking about.
http://examples2.ext.net/#/Layout/ColumnLayout/Basic/