2013-07-07 83 views
0

我是新來的,一般使用XAML和C#所以這可能是一個簡單的問題,但我有我的XAML爲使製作XAML佈局動態

<Page 
x:Class="Tournament_Director_Windows.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:Tournament_Director_Windows" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d"> 

<Grid Background="LightGray"> 
    <Button Style="{StaticResource AddAppBarButtonStyle}" Foreground="#FF094AB2" Click="onAddNewBowlerClick" HorizontalAlignment="Right" RenderTransformOrigin="0.4,0.508" Margin="0,10,115,679"/> 
    <ListView Height="648" Width="377" HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="itemListView" ItemClick="itemListView_ItemClick" ItemsSource="{Binding}" IsItemClickEnabled="True" Margin="225,110,0,0"> 
     <ListView.ItemTemplate> 
      <DataTemplate> 
       <TextBlock Text="{Binding Name}"/> 
      </DataTemplate> 
     </ListView.ItemTemplate> 
    </ListView> 
    <TextBlock TextWrapping="Wrap" Text="Bowlers" Height="54" Width="177" FontSize="50" Foreground="#FF094AB2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="225,10,964,704"/> 
    <Button Style="{StaticResource RefreshAppBarButtonStyle}" Click="onSyncClick" Background="#FFF8FCFD" HorizontalAlignment="Right" Foreground="#FF094AB2" BorderBrush="#FFFBF9F9" Margin="0,10,10,679"/> 
    <ListView HorizontalAlignment="Left" Height="Auto" Width="220" Background="Silver" SelectionChanged="MenuListView_SelectionChanged"> 

     <!--<ListView.Resources> 
      <Style TargetType="ListViewItem"> 
       <Setter Property="Foreground" Value="#FF094AB2" /> 
       <Setter Property="FontSize" Value="30" /> 
       <Setter Property="Height" Value="75"/> 
      </Style> 
     </ListView.Resources>--> 

     <ListView.ItemContainerStyle> 
      <Style TargetType="ListViewItem"> 
       <Setter Property="Foreground" Value="#FF094AB2" /> 
       <Setter Property="FontSize" Value="25" /> 
       <Setter Property="Height" Value="75"/> 
       <Setter Property="Padding" Value="10"/> 
      </Style> 
     </ListView.ItemContainerStyle> 

     <x:String>Bowlers</x:String> 
     <x:String>Brackets</x:String> 
     <x:String>Scores</x:String> 
    </ListView> 
    <ScrollViewer Height="Auto" HorizontalAlignment="Stretch" Width="754" Margin="602,110,0,10"> 

    </ScrollViewer> 
</Grid> 

我的問題是關於ScrollViewer末,我有它作爲一個設置的寬度,但我想要做的是寬度填充屏幕的其餘部分從我的ListView旁邊的設置位置,所以不管你有什麼樣的屏幕尺寸它看起來都一樣,如果你沒有一個大的空間有更大的屏幕或因爲屏幕更小而被切斷。

我該怎麼做?

+0

我想'Grid'也支持WinRT中的'Width =「1 *」',這就是你所追求的。 http://msdn.microsoft.com/en-us/library/system.windows.controls.grid.aspx – Silvermind

回答

1

嘗試使用<ColumnDefinitions>與width屬性"Auto""*"<RowDefinitions>與height屬性"Auto""*"爲網格。在這種情況下,您可以管理您的內容的哪部分具有永久大小,以及哪部分將使用窗口調整大小。