开发者

How to set width to 100%

开发者 https://www.devze.com 2023-01-08 14:28 出处:网络
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

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

精彩评论

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