C# 使XAML布局动态化

C# 使XAML布局动态化,c#,xaml,winrt-xaml,C#,Xaml,Winrt Xaml,一般来说,我不熟悉使用XAML和C,所以这可能是一个简单的问题,但我也有自己的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

一般来说,我不熟悉使用XAML和C,所以这可能是一个简单的问题,但我也有自己的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旁边的设置位置填充屏幕的其余部分,因此无论屏幕大小如何,它看起来都是一样的,如果屏幕较大,就没有大的空间,或者因为屏幕较小而被切断


我该怎么做

尝试对网格使用宽度属性为
“*”
和高度属性为
“Auto”
“*”
。在这种情况下,您可以管理内容的哪些部分具有永久大小,哪些部分将通过窗口调整大小。

我想
网格
也支持WinRT中的
Width=“1*”
,这正是您所追求的。