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