Skip to main content

Microsoft Silverlight

Answered Question Dynamic height of a controlRSS Feed

(0)

poulraider
poulraider

Member

Member

86 points

66 Posts

Dynamic height of a control

Hello, wondering if theres away to change the size of the actuel silverlight control based on its content.

Reason beeing: I got a menu that i placed with absolute css values etc, useing transperent backgrounds and windowless etc it looks how i expect it to look. On the page you only see the top 29px as the height of the visible content, and i want to make some kind of dropdown rendered over the other content. This would also work. My problem is that the height of the control is 500 to make room for etc dropdown content, but you wont see this as its position with abolute and transperent backgrounds, only way you would notice it would be if you right click on the page below the menu(where dropdown content is going to show) you will get the silverlight menu(where you would expect to get the page rightclick menu)

 

So is it posible to change the height of the control based on its content or set the height in the code based on states etc?

Cass
Cass

Contributor

Contributor

3157 points

654 Posts

Answered Question

Re: Dynamic height of a control

If you set the UserControl Width/Height to Auto, and use HorizantolAlignment/VerticalAlignment to "Stretch" with Margins 0 it should do it automatically.

poulraider
poulraider

Member

Member

86 points

66 Posts

Re: Dynamic height of a control

Its not working for me.

the with/height overrite it from the asp:silverlight tag.

<asp:Silverlight ID="Xaml1" PluginBackground="Transparent" Windowless="true" runat="server"

Source="~/ClientBin/MenuSilverLight.xap" Version="2.0" Width="697px" Height="318px" >

And if i dont specify thise, the control dont show.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities