I have a silverlight stackpanel and i want to set its width to 100%.
i'm adding the stackpanel dynamically (C#)
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?