2011-05-20 3 views
1

私はリボンのタブとデータグリッドを持つ私のメインウィングを持っています。私はウィンドウが画面に合わせて最大化されたときにウィンドウ内のすべてのものを最大化する方法は?私はビューボックスを使用しようとしていますが動作しません。ウィンドウがwpfで最大化されると、ウィンドウ内のすべてを伸ばすことができますか?

<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> 

そして私は、グリッドタグ

ヘルプの前に追加してみました。アドバンス

+0

を動作するはずです私はあなたがViewBoxを持つあなたのXAMLコードを投稿することができ、より良く、より具体的な答え –

+1

を得るためにあなたのXAMLコードのサンプルを掲示することをお勧め? – Rachel

+0

@Rachel Plsは、編集された質問で自分のコードを見ています。 – CPM

答えて

1

あなたViewBoxをにStretchDirection="Both"を追加し、それが

// 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"> 
+0

ええ、ストレッチしているフォントが大きくなるようにし、グリッドとタブ全体が大きくなるように私は大きな画面でこれを投影する場合は大きく見えます。私はあなたが私が何を言っているのか理解していることを願っています。ご回答いただきありがとうございます – CPM

+0

@CPM私の編集を参照 – Rachel

+0

私はすべてのウィンドウがラインで凝縮されるようにしようとすると動作しません。 – CPM

0

おかげで私はちょうど出かけ、あなたがコントロールの側面にあなたのビューボックスを固定する必要があることを推測するつもりです。これがmarginプロパティです。

ViewBoxは、XAMLにMargin=5,5,5,5のようなものがあります。

+0

ごめんなさい – CPM

+0

@CPMは編集を見ています。 – msarchet

+0

これを試しましたが、動作していません。 – CPM

関連する問題