Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Storyboard that changes height of a control from 0-100% ?
3 replies. Latest Post by asp2designer on October 14, 2008.
(0)
Kevmeister
Member
249 points
119 Posts
10-08-2008 2:19 AM |
We have a data entry "form" coded in Silverlight and have built a very simple "error display control" which "slides open" when there are errors with the form.
The "slide open" effect is really just increasing the height of the control progressively to give a slo-mo appearance.
We can use a Storyboard to control the height of the control, but things are complicated by the fact that we don't know the height of the control since its height is dependent on its FontFamily, FontSize, and number of errors.
One option I can think of requires the control implementation to somehow "remember the full height" and prime the storyboard with the "max height" value. I don't want to do this (I think) because then any re-styling of the control needs to always provide that Storyboard - seems like a needless imposition.
The only other solution I can think of is to not control the height directly but instead use a ScaleTransform. That will give the slide-open effect but the contents of the "error display control" as it is opening will look all compressed in the vertical direction, which is not the effect we want.
Any ideas on achieving this?
Amanda W...
All-Star
17241 points
1,466 Posts
10-10-2008 3:20 AM |
Hi,
How about try to to set the control's height is auto. so the size of the control will be changed by its content?
10-13-2008 8:29 PM |
I don't think you understand what we are trying to do: We have a TextBlock that has some text in it. We want to increase its height from 0 pixels to <Auto-Height> to give the textbox the appearance of "sliding open", where <Auto-Height> is the height the TextBlock would be if we set the Height to Auto.
asp2desi...
12 points
27 Posts
10-14-2008 12:37 AM |
Maybe you could try the min-hieght property. So that the control will initially expand to the value of the min-height property and expand more if the content requires more vertical space. Then maybe you can avoid clipping the content.