Auto Fit

 
Task Assigned To Start Date Due Date Priority Progress
Simplify & Clarify Product Messaging
John Heart 4/3/2018 4/14/2018 Low In progress
Create Action Plan To Improve Customer Engagement
Robert Reagan 8/8/2017 4/8/2018 Medium In progress
Increase Average Subscription Price
Wally Hobbs 8/9/2017 9/13/2017 Low In progress
Reduce Churn to Less Than 1% Monthly
Arnie Schwartz 2/12/2018 5/1/2018 Low In progress
Finalize The Content Strategy
Stu Pizaro 3/10/2018 4/11/2018 High In progress
Grow Subscriber Base by 5% Per Week
Sandra Johnson 7/24/2017 2/10/2018 Low In progress
Increase The CTR% To Above Industry Average 3.5%
Karen Goodson 7/11/2017 4/15/2018 Low In progress
Close The Final Budget
Hannah Brookly 6/5/2017 6/18/2017 Low In progress
Achieve Record Metrics In All Areas
Ed Holmes 4/24/2017 2/3/2018 Low In progress
Begin Content Review
Victor Norris 4/27/2017 2/25/2018 Medium In progress
Produce Online Survey
Karen Goodson 10/14/2017 3/25/2018 Low In progress
Improve Our Content And Its Distribution
Arnie Schwartz 4/29/2017 11/9/2017 High In progress
Update Old Content
Maggie Boxter 2/2/2018 4/2/2018 Medium In progress
Map And Analyze Marketing Channels
Samantha Bright 7/5/2017 4/19/2018 Low In progress
Research And Improve Customer Satisfaction
Robin Cosworth 10/27/2017 4/30/2018 Medium In progress
Present An Action Plan For Next Quarter
Arnie Schwartz 6/6/2017 5/11/2018 High In progress
Achieve Record Revenues While Increasing Profitability
Samantha Piper 10/21/2017 2/28/2018 Low In progress
Hit Quarterly Revenue Of Over $1000000
Clark Morgan 8/30/2017 1/7/2018 Low In progress
Start Sales In 2 New Countries
Brad Farkus 9/26/2017 10/4/2017 Low In progress
Increase Gross Profit Margin % From 63% To 54%
Sandra Johnson 7/14/2017 10/25/2017 Low In progress
Data grid with 37 rows and 6 columns

Call the AutoFitColumnWidths method to resize columns based on content (best fit).

This method takes header, data cell, and summary value content into account. The auto fit algorithm uses the same units as the column's Width property value.

  • If a column's width is set in pixels, the final width is in pixels. The column's width fits its content.
  • If a column's width is set in percentages or not set, the final width is in percentages. Columns may shrink or grow depending on the available space.

Depending on calculated values, the following outcomes are possible:

  • Columns occupy the entire width of the component. Example: all or several widths are in percentages.
  • A scroll bar appears. Example: all widths are in pixels and the content is too wide.
  • Empty space remains. Example: all widths are in pixels and the content is not wide enough.

In this demo, Task, Assigned To, and Progress column widths are in pixels, and their content is always fully visible. Other column widths are not specified – as such, these columns may shrink (to the limit set by MinWidth).