开发者

How to set width to 100%

I have a silverlight stackpanel and i want to set its width to 100%.

i'm adding the stackpanel 开发者_如何转开发dynamically (C#)


Try setting HorizontalAlignment to "Stretch" on your StackPanel and make sure your containing element is also the width you expect.


private void CreateMyDynamicStackPanel()
{
    StackPanel MyStackPanel = new StackPanel();
    MyStackPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
    MyStackPanel.Width = 300;
}

Instead of 300, use a property of the parent container?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜