Silverlight 5中的堆栈面板

时间:2013-01-23 12:36:14

标签: .net xaml silverlight-5.0

任何人都可以告诉我如何在.cs编码中创建stackPanel?我需要通过编码创建多个堆栈面板。任何人都可以帮忙解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您需要在主页面中有一个容器到您的堆叠面板。

<强>的Xaml

<Grid x:Name="LayoutRoot" Background="White" Width="500" Height="500">

</Grid>

<强>代码

StackPanel sp = new StackPanel(); 
sp.Orientation = Orientation.Horizontal; 
//add something in your stack panel
LayoutRoot.Children.Add(sp);