3
我有一个WPF业务线应用程序。它们大部分都在标签页的用户控件中。 我有一个问题,找出如何布局,以便它适合任何解决方案(如有必要滚动)。 这是代码中描述的问题,因为我真的无法弄清楚如何把它放到文本中,如果它不清楚,请让我知道我会尝试绘制一些东西。帮助我的WPF布局
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition> <!--What i actually want to say here isn't "take all remaining space" but "take all remaining space without scrolling,
and then scroll based on everything as if this was auto and no longer *-->
<ColumnDefinition Width="Auto"></ColumnDefinition><!--But what happens for now is that since this is auto , it will not scroll at all untill the * column has fully scrolled-->
</Grid.ColumnDefinitions>
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label></Label>
<TextBox></TextBox>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1">
<StackPanel Orientation="Horizontal">
<button> <!-- I want the button's container to be in an auto column , don't
want it to take size away from the fields unless needed but don't
want it to stay visible at the expense of the fields either -->
</StackPanel>
</StackPanel>
<TelerikGrid:RadGridView Grid.Row="1" Grid.ColumnSpan="2">
<TelerikGrid:RadGridView.Columns>
<TelerikGrid:GridViewDataColumn Width="*"/> <!-- This makes my grid take a bajillon kilometers because it itself is in a Grid's column of * size itself in a scrollviewer -->
</TelerikGrid:RadGridView.Columns>
</TelerikGrid:RadGridView>
</Grid>
行和列的编号从0开始,而不是从1开始。您错了。 – svick 2010-08-22 12:13:21
对不起,我想做一个简单的例子,并添加了一些数据,它是可选的(因为它默认为0/0,如果没有添加)的错字。将解决它,但不是造成问题的原因。 – 2010-08-22 12:59:48
是您的第一个ScrollViewer内的StackPanel吗?否则,我不认为它会滚动。 – 2010-08-22 14:03:51