Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能告诉我如何在 .cs 编码中创建 stackPanels?我需要通过编码创建多个堆栈面板。有人可以帮忙吗?
您需要在您的堆栈面板的主页中有一个容器。
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);