Dec 22, 2015, 2:12 PM
[CLOSED] Align to width of longest label
Hi
I have a dynamic form, where I read field labels from a data source and I want to align those labels by width of longest. Sample goes:
I have a dynamic form, where I read field labels from a data source and I want to align those labels by width of longest. Sample goes:
X.FormPanel().BodyPadding(6).Items
(
items =>
{
string[] labels = new string[] { "this is some verrrrryyyyy looong label", "Normal label", "Short" };
for (int i = 0; i < labels.Length; i++)
{
items.Add
(
X.FieldContainer().Layout(LayoutType.HBox).LayoutConfig(new HBoxLayoutConfig() { Align = HBoxAlign.Middle }).Border(true)
.Items
(
fields =>
{
Label label = new Label(labels[i] + ":");
//label.Width = 110; //<== if I uncomment this I get behavior that I want but label is truncated
label.PaddingSpec = "0 6 0 0";
ComboBox comboOperators = new ComboBox();
comboOperators.Editable = false;
comboOperators.Width = 50;
comboOperators.FieldStyle = "text-align:center";
comboOperators.PaddingSpec = "0 6 0 0";
comboOperators.Items.AddRange(new ListItem[] { new ListItem("="), new ListItem("<>"), new ListItem(">"), new ListItem(">="), new ListItem("<"), new ListItem("<="), new ListItem("[]") });
comboOperators.SelectedItem.Index = 0;
TextField textField = new TextField();
textField.Width = 500;
textField.PaddingSpec = "0 6 0 0";
fields.AddRange(new ComponentBase[] { label, comboOperators, textField });
}
)
);
}
}
)
Last edited by fabricio.murta; Dec 28, 2015 at 12:07 PM.
Reason: [CLOSED]