Monday, April 09, 2012

Better Way to Set Web Part Height

We've had customers ask us the best way to set the height of our IntelliGantt Web Part for SharePoint, which at first we thought was kind of odd as every SharePoint web part supports height and width adjustment as part of its Appearance. However, we quickly noticed that a Silverlight web part behaves differently. For example, if you set a specific height, then you get an unnecessary vertical scroll bar that is quite hackneyed. Worse yet, if you used the vertical scroll bar you noticed the specified height of the web part was duplicated with empty space as you scrolled down. This is due to a CSS style sheet being used (overflow:auto) that you cannot unset (ie. overflow:hidden).

So after a bit of experimentation we decided to introduce another way- our own 'Pixel Height' field so that behavior matches expectations. What you will want to do is set the 'Appearance' height to 'No, adjust height to fit in zone'. Then, in our 'IntelliGantt' category, you can specify the height in pixels you prefer. With this, we can explicitly tell SharePoint the height to use for the web part-- and no vertical scroll bar. For example:

1 comment:

Cindy Dy said...

Your blog is fabulous.