Dashboard Text wrapping / Row Height

I think something related to grouping might be screwing it up? I notice that when things are un-grouped I can resize each row individually but when things are grouped resizing one row resizes them all…

Yeah, I added a button and put the code in the click event. It does what I want.

How would I go about making it so that my code runs after the data loads? I tried Form load and InitializeLayout for the grid but neither had the desired result.

Perhaps try an InitializeLayout event. Put this in your Initialize code (change the ref as needed)

yourGridRef.InitializeLayout += (o,e) =>
{
  var sender = (EpiUltraGrid)o;
  sender.DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;
  //etc, rest of code here
};
2 Likes

That worked! - must be I set up the InitializeLayout event wrong the first time or didn’t reload the customization correctly. (Unless using an inline function makes a difference…?)

Big thanks :slight_smile:

The inline wouldnt matter so much as having to explicitly create the event since you cant use the wizard on a native control. Glad it worked!

1 Like

Hi all,

I have followed all the steps described, but the event for initializeLayout just won’t trigger. I tried both inline function and separate function.

I think this person in this post also had the same problem.

Here is my code, the MessageBox for Event Triggered just won’t fire. Any ideas?

public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	dayLoadGrid = (EpiUltraGrid) csm.GetNativeControlReference("236c8dfb-5f01-4403-b73e-d104d2eb92c9");
	dayLoadGrid.DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;
	dayLoadGrid.DisplayLayout.Override.CellMultiLine = Infragistics.Win.DefaultableBoolean.True;

	foreach ( Infragistics.Win.UltraWinGrid.UltraGridRow row in dayLoadGrid.Rows.All)
    {
    	row.PerformAutoSize();
    }

	dayLoadGrid.InitializeLayout += (o,e) =>
	{
		MessageBox.Show("Event triggered");
	    var sender = (EpiUltraGrid)o;
	    sender.DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;
	    //etc, rest of code here
	};
	// dayLoadGrid.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.dayLoadGrid_InitializeLayout);
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	// End Wizard Added Custom Method Calls

	MessageBox.Show("InitializeCustomCode");
}

Yeah, that didn’t work reliably for me either. I ended up just using the load event instead, works fine for my purposes.

	private void MainController_Load(object sender, EventArgs args)
	{
		Ice.Lib.Customization.PersonalizeCustomizeManager personalizeCustomizeManager = this.csm.PersonalizeCustomizeManager;
		// myGrid
		Ice.Lib.Framework.EpiUltraGrid local2 = ((Ice.Lib.Framework.EpiUltraGrid)(personalizeCustomizeManager.ControlsHT["a982c660-8da7-4c1a-a775-624d31758cb5"]));
		local2.DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;
		local2.DisplayLayout.Override.CellMultiLine = Infragistics.Win.DefaultableBoolean.True;
	}
2 Likes

Would you mind posting a screen shot of the final results? I would like to see what the grid ends up looking like.

1 Like

Hello Evan,

Have you tried this for the columns headers as well? Having the ability to have 2 lines per column would help reduce the width, and still having meaningfull column headers, instead of truncated ones…:wink:

Pierre

1 Like

Shhh, don’t give them ideas. Besides I haven’t figured out how to get the “page setup” menu item to come back with this customization present.

1 Like

That’s nice solution. I want to understand a little better before I try it. Basically you are setting the width via some method (properties, or code, or personalization or whatever) and the AutoFree command then sets the row height based on the text in the cell right?

@Evan_Purdy @Chris_Conn?

Actually I just had the width set by dragging the columns in developer mode and saving it. Only the row height is being set from code. I bet you can set the column widths from code as well, but I didn’t have any need for them to dynamically change, paper stays the same size…

Otherwise yes, this is a very simple customization.

1 Like
  1. Are LF’s, CR’s, or other line breaks in the text supported?
  2. Any way to set a max row height? So an auto-height row can’t get too big.
  1. Yes, seems like it might be picky about the characters though. I would use Environment.NewLine to be sure.
  2. I think DisplayLayout.Override.RowSizingAutoMaxLines can be used to set the max number of lines for the rows. Remember these are all just Infragistics controls in the background, so looking at the documentation for the infragistics UltraGrid can be helpful.
1 Like

I’m too new to coding.
Error occurs, what do I miss?

var yourGridRef = (EpiUltraGrid)csm.GetNativeControlReference(“your guid here a9a…”);
yourGridRef.InitializeLayout += (o,e) =>

1 Like

Thanks!

DisplayLayout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;

This works to me.

This worked but is there a way to set it so that the minimum row is 1 instead of the default two line height? It seems like all rows are defaulting to two rows regardless of wrapping or not. Or if this can be applied to only one column and not all column wrapping.