同時要求在http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f765d4c9-1719-4757-b467-2492d87bb4abWPF上ScaleTransform問題,多個UI元素
所有,
滾動我執行我的WPF應用程序的比例變換的滑塊。現在我遇到了一個問題,其中一個具有Height =「*」的行內的scrollviewer中有一個元素,而後續行中具有Height =「Auto」的另一個元素。
目標是我們直到運行時才知道行高(或者甚至元素有多大),但是我們將在屏幕上顯示這兩個元素,第一個元素佔用儘可能多的空間和底部元素始終可見,佔用所需的任何空間。
我有以下問題/解決方案聲明(我認爲它最能描述我的問題),正如您所看到的,當我想要實現此目標並仍然允許訪問所有UI時,我堅持要做什麼元素應該足夠大以將其中一個元素從屏幕上移開(希望這是有意義的)。
Problem statement:
ScaleTransform is causing top DG to disappear where RowDefinition Height="*"
Solution:
Set Minimum height on RowDefinition to prevent DG from disappearing.
Problem statement:
Setting Minimum height on RowDefinitoin causes lower rows to dissapear.
Solution:
Add scrollviewer encapsulating grid.
Problem statement:
Since top DG is in RowDefinition Height="*", if there is a lot of data in top DG, bottom DGs cannot be seen without scrolling.
Solution statement:
???
這裏是我當前的代碼:
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="120" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox Grid.Row="0">
<DataGrid ItemsSource="{Binding Path=SomePathThatCouldHaveLotsOfData}">
<!--Note that DataGrid implements its own scrollviewer as long as it's not surrounded by another scrollviewer-->
<!--...-->
</DataGrid>
</GroupBox>
<GroupBox Grid.Row="1">
<!--...-->
</GroupBox>
希望這一切是有意義的就是我的問題是什麼,我試圖做的。任何想法,我可以做到這一點(希望以一種乾淨的方式)。如果有幫助,我使用MVVM。
編輯:我應該指出,我也不會知道任何最大高度,直到運行時間(和max-height可能無關,因爲我們將使用規模轉換)。