1

リボンタブとデータグリッドを備えたメインウィングを持っています。ウィンドウが画面に合わせて最大化されているときに、ウィンドウのすべてを最大化するにはどうすればよいですか?ビューボックスを使用しようとしていますが、機能しません。

<Viewbox Stretch="Uniform">
        <Grid x:Name="LayoutRoot">

            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>


                <ribbon:Ribbon x:Name="Ribbon">

                    <ribbon:RibbonTab x:Name="HomeTab" 
                                  Header="Home">
                        <ribbon:RibbonGroup x:Name="Group1" 
                                        Header="Refresh">
                            <ribbon:RibbonButton x:Name="BtmRefresh"
                                             LargeImageSource="Images\refresh.png"
                                             Label="Refresh" Margin="25,0,30,0" Click="BtmRefresh_Click" />
                        </ribbon:RibbonGroup>
                    </ribbon:RibbonTab>
                </ribbon:Ribbon>


            <StackPanel Name="PanelDataGrid" Height="Auto" >

                    <DataGrid  AutoGenerateColumns="False" Margin="0,138,0,0" Name="dataGrid" Height="Auto" ItemsSource="{Binding}"  SelectionUnit="Cell"   AlternatingRowBackground="#FFDFE9F5"
                 SelectionMode="Single" ColumnWidth="68"  HeadersVisibility="Column" RowBackground="{x:Null}" >
                        <DataGrid.Background>
                            <ImageBrush ImageSource="/GridCellColor;component/Images/barcode.png" />
                        </DataGrid.Background>
                        <DataGrid.Columns >

                            <DataGridTextColumn Binding="{Binding Path=Job_Num}"  Header="Job Nº" IsReadOnly="True" Width="1*" />
                            <DataGridTextColumn Binding="{Binding Path=Product_Code}" IsReadOnly="True" Header="Product" Width="1*" />
    </DataGrid.Columns>
                    </DataGrid>
                 </StackPanel>

        </Grid>
    </Viewbox>

そして、グリッドタグの前に追加してみました

ヘルプ。

前もって感謝します

4

2 に答える 2

1

StretchDirection="Both"ViewBoxに追加すると、機能するはずです

// Will Stretch it and keep the ratio the same
<Viewbox Stretch="Uniform" StretchDirection="Both">


// Will Stretch it to fill full screen regardless of ratio
<Viewbox Stretch="Fill" StretchDirection="Both">
于 2011-05-20T14:45:46.517 に答える
0

ビューボックスをコントロールの側面に固定する必要があると思います。これは余白のプロパティです。

XAMLのViewBoxように見えるものが必要Margin=5,5,5,5です。

于 2011-05-20T14:28:37.103 に答える