Skip to main content

Microsoft Silverlight

Unanswered Question Storyboard that changes height of a control from 0-100% ?RSS Feed

(0)

Kevmeister
Kevmeister

Member

Member

249 points

119 Posts

Storyboard that changes height of a control from 0-100% ?

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 Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Re: Storyboard that changes height of a control from 0-100% ?

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?

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Kevmeister
Kevmeister

Member

Member

249 points

119 Posts

Re: Storyboard that changes height of a control from 0-100% ?

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.

 

asp2designer
asp2desi...

Member

Member

12 points

27 Posts

Re: Re: Storyboard that changes height of a control from 0-100% ?

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.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities