StiPanel CanGrow Does Not Grow With Internal StiText Elements
Posted: Thu Apr 15, 2021 12:56 am
I have the below code (C#) and am rending out a word wrapped StiText element INSIDE a StiPanel (Mine is inherited in custom class). Both have CanGrow set to true, yet the Panel will not grow and show all of the text when it is taller than the Panel.
What Am I Missing?
IMAGE ATTACHED TO SHOW DISPLAY FAIL. THERE ARE ACTUALL SIX ITEMS IN ARRAY
*** CODE ***
if(param != null)
{
var searchPanel = new StiPanel();
searchPanel.CanShrink = true;
searchPanel.Top = headerText.Bottom;
var tile = new ContentDisplayTile(); //-- CUSTOM PANEL
tile.CanGrow = true; //-- SET CAN GROW
tile.CanShrink = true;
tile.Name = "Tile " + count.ToString();
//tile.Width = .5;
tile.Height = .6;
var keyText = new StiText(new RectangleD(.05, .01, .9, .15));
keyText.CanGrow = true; //-- CAN GROW HERE
keyText.CanShrink = true;
keyText.TextBrush = new StiSolidBrush(Color.Gray);
keyText.Name = param.Key;
keyText.Text.Value = param.Key + ":";
keyText.ShrinkFontToFit = true;
keyText.Font = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular);
keyText.GrowToHeight = true;
var valueText = new StiText(new RectangleD(.05, .16, .9, .15));
keyText.CanGrow = true; //-- CAN GROW HERE
keyText.CanShrink = true;
valueText.TextBrush = new StiSolidBrush(Color.Gray);
valueText.Name = param.Value.ToString();
valueText.Text.Value = param.Value.ToString();
valueText.ComponentStyle = "Bold";
valueText.UseParentStyles = false;
valueText.WordWrap = true;
valueText.Font = new Font(FontFamily.GenericSansSerif, 5, FontStyle.Bold);
valueText.GrowToHeight = true;
tile.Width = valueText.Width + .1;
tile.Components.Add(keyText);
tile.Components.Add(valueText);
searchPanel.Components.Add(tile);
header.Components.Add(searchPanel);
}
What Am I Missing?
IMAGE ATTACHED TO SHOW DISPLAY FAIL. THERE ARE ACTUALL SIX ITEMS IN ARRAY
*** CODE ***
if(param != null)
{
var searchPanel = new StiPanel();
searchPanel.CanShrink = true;
searchPanel.Top = headerText.Bottom;
var tile = new ContentDisplayTile(); //-- CUSTOM PANEL
tile.CanGrow = true; //-- SET CAN GROW
tile.CanShrink = true;
tile.Name = "Tile " + count.ToString();
//tile.Width = .5;
tile.Height = .6;
var keyText = new StiText(new RectangleD(.05, .01, .9, .15));
keyText.CanGrow = true; //-- CAN GROW HERE
keyText.CanShrink = true;
keyText.TextBrush = new StiSolidBrush(Color.Gray);
keyText.Name = param.Key;
keyText.Text.Value = param.Key + ":";
keyText.ShrinkFontToFit = true;
keyText.Font = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular);
keyText.GrowToHeight = true;
var valueText = new StiText(new RectangleD(.05, .16, .9, .15));
keyText.CanGrow = true; //-- CAN GROW HERE
keyText.CanShrink = true;
valueText.TextBrush = new StiSolidBrush(Color.Gray);
valueText.Name = param.Value.ToString();
valueText.Text.Value = param.Value.ToString();
valueText.ComponentStyle = "Bold";
valueText.UseParentStyles = false;
valueText.WordWrap = true;
valueText.Font = new Font(FontFamily.GenericSansSerif, 5, FontStyle.Bold);
valueText.GrowToHeight = true;
tile.Width = valueText.Width + .1;
tile.Components.Add(keyText);
tile.Components.Add(valueText);
searchPanel.Components.Add(tile);
header.Components.Add(searchPanel);
}