2012-09-11 5 views
2

WPF를 처음 사용합니다. 내 코드에는 몇 가지 컨트롤이있는 간단한 WPF 창이 있습니다. 모든 컨트롤은 뷰 박스에 포함되어 있습니다. 내 문제는 내가 창 크기를 조정할 때 컨트롤 크기 텍스트 비율 비례하지 않습니다. 여기 내 코드는 다음과 같습니다.뷰 박스 내부의 모든 컨트롤의 높이 및 너비 조절

<Window x:Class="DesktopGoogleReader.UIelements.About" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="About" Height="346" Width="435" 
    > 
    <Window.Background> 
     <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.5"> 
      <LinearGradientBrush.GradientStops> 
       <GradientStop Offset="0" Color="#eee" /> 
       <GradientStop Offset="1" Color="#ccc" /> 
      </LinearGradientBrush.GradientStops> 
     </LinearGradientBrush> 
    </Window.Background> 
    <Viewbox Stretch="Uniform"> 
     <Grid>   
     <Label Height="41" Margin="83,12,12,0" Name="label1" VerticalAlignment="Top" FontSize="20" FontWeight="Bold">Desktop Google Reader</Label> 
     <Image Margin="348,0,0,0" Name="image1" Stretch="Fill" Height="65" HorizontalAlignment="Left" VerticalAlignment="Top" Width="65" Source="C:\Users\TRIDIP\Desktop\tmp\Desktop Google Reader WPF good UI\trunk\DesktopGoogleReader\DesktopGoogleReader.ico" /> 
     <Label Height="28" Margin="92,49,12,0" Name="label_versionName" VerticalAlignment="Top">Version: Versionnumber</Label> 
     <TextBlock Margin="12,83,12,0" Name="textBlock1" Height="54" VerticalAlignment="Top" Text="Desktop Google Reader is Windows/.NET based client to the RSS aggregation service Google Reader. It is licensed under the New BSD License (BSD). It is developed by Konstantins Onufrijevs and Sven Walther" TextWrapping="Wrap" /> 
     <Label Margin="12,134,12,0" Name="label2" Height="29" VerticalAlignment="Top">Credits: Desktop Google Reader uses the following external resources:</Label> 
     <Button HorizontalAlignment="Left" Margin="12,161,0,0" Name="button_snarlChsarp" Width="173" Height="23" VerticalAlignment="Top" >Snarl Connector</Button> 
     <Button Margin="191,161,0,0" Name="button_TweetSharp" Height="23" VerticalAlignment="Top" HorizontalAlignment="Left" Width="173" >TweetSharp</Button> 
     <Button Height="23" HorizontalAlignment="Left" Margin="12,190,0,0" Name="button_iconSet" VerticalAlignment="Top" Width="173" >Function Icon Set</Button> 
     <Button Height="23" Margin="191,190,0,0" Name="button_facebook" VerticalAlignment="Top" HorizontalAlignment="Left" Width="173" >Facebook Developer Toolkit</Button> 
     <Button Height="23" HorizontalAlignment="Left" Margin="12,219,0,0" Name="button_awesomium" VerticalAlignment="Top" Width="173" >Web Kit .NET</Button> 
     <Button Height="23" Margin="191,219,0,0" Name="button_winkle" VerticalAlignment="Top" HorizontalAlignment="Left" Width="173" >Winkle Update System</Button> 
     <TextBlock Height="59" Margin="12,248,12,0" Name="textBlock_contributors" VerticalAlignment="Top" Text="Contributors: We want to thank all the people using Desktop Google Reader. A special thanks goes to Henry C. for his continues help in improving and supporting our project." TextAlignment="Left" TextWrapping="Wrap" /> 
    </Grid> 
    </Viewbox> 
</Window> 

답변

2

스트레치를 수정해야합니다.

균일하면 텍스트 비례를 유지합니다.
아마도 Fill을 찾고있을 것입니다.

Stretch Enumeration

은 크기를 조정하지 않을 컨트롤의 높이와 폭을 설정하지 마십시오.
그리고보기 상자를 그리드에 놓으십시오 (보기 상자의 그리드가 아님).

<Grid> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*"/> 
    </Grid.ColumnDefinitions> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 
    <Viewbox Grid.Row="0" Grid.Column="0" Stretch="Fill"> 
     <TextBox Text="size me" TextChanged="TextBox_TextChanged" /> 
    </Viewbox> 
    <Viewbox Grid.Row="1" Grid.Column="0" Stretch="Fill"> 
     <TextBox Text="size me to0 " TextChanged="TextBox_TextChanged" /> 
    </Viewbox> 
</Grid> 
+0

나는 텍스트에 대해 이야기하고 있지 않습니다. 창 크기를 조정할 때 viewbox 안에있는 textblock 단추 등의 모든 컨트롤을 비례 적으로 늘리거나 줄여야합니다. 그래서 어떻게하는지 안내하겠습니다. 덕분에 – Thomas

+0

다음 "컨트롤 크기 텍스트 비례하여 크기가 조정되지 않습니다"질문에 대한 문구 작업. 크기가 고정되어 있으므로 (높이와 너비는 크기가 조정되지 않습니다. – Paparazzi