2010-08-11 5 views
0

"Xidth"라는 단어에 대한 XAML 파일을 이미 살펴본 결과 전체 요소의 너비를 설정하는 루트 요소의 값으로 숫자가 나타납니다. 단어 "높이"는 루트 요소에 숫자 값만 있고 두 개의 텍스트 상자는 아래의 확인란과 동일한 그리드 셀에 없습니다.WPF에서 컨트롤의 크기를 조정할 수 없습니다.

불행하게도 관계없이 내가 높이와 폭에 대한 UserControl을 요소에 설정된 값의 다음 확인란 커질하지 않습니다

WPF의 요소
<Style x:Key="CheckBoxStyle1" TargetType="CheckBox"> 
      <Setter Property="Template"> 
       <Setter.Value> 
        <ControlTemplate TargetType="CheckBox"> 
         <Grid ToolTipService.ToolTip=""> 
          <VisualStateManager.VisualStateGroups> 
           <VisualStateGroup x:Name="CheckStates"> 
            <VisualState x:Name="Checked"> 
             <Storyboard> 
              <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="path" d:IsOptimized="True"/> 
             </Storyboard> 
            </VisualState> 
            <VisualState x:Name="Unchecked"/> 
            <VisualState x:Name="Indeterminate"/> 
           </VisualStateGroup> 
          </VisualStateManager.VisualStateGroups> 
          <Image x:Name="lightbulb" Source="BestLogin_Images/lightbulb.png" ToolTipService.ToolTip=""/> 
          <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="140,0,0,0" Content="" ToolTipService.ToolTip=""/> 
          <Path x:Name="path" Data="M41.75,5.5 L53.75,2.25 L58.5,0.75 L65.75,1.5 L73,3.75 L83.25,8.25 L88.5,13.25 L95.5,21 L102,33.75 L102.5,44.5 L97.5,59.25 L90.25,74.75 L86.5,82.5 L84.25,91.5 L83.75,96.5 L79.5,104.25 L79.75,108.75 L78.5,113.25 L80,114.5 L79.75,119.75 L79,126 L76.75,132 L74.5,134.5 L68.75,140.5 L65,142 L64.53125,143.125 L62.75,144.75 L61.4375,145.59375 L57.71875,145.90601 L55.15625,143.46875 L53.4375,142.40625 L50.625,141.46875 L47.15625,137.34375 L43.5,135 L40.375,129.84375 L39.5,128.53125 L40.4375,127.375 L41.25,126.09375 L41.15625,124.78125 L39.15625,123.65625 L39.343998,121.5625 L39.343998,116.15625 L39.406498,111.3125 L38.750252,104.90625 L35.583599,99.791664 L35.292271,91.125 L33.375278,80.75 L31.54195,77.583336 L26.791613,69.75 L21.332918,59.541668 L19.874918,56.25 L19.08325,37.708332 L19.37525,36.75 L21.750242,27.333334 L27.041893,18.416666 L31.79188,11.833333 L37.416862,7.0833335 L38.791859,6.5833335 z" HorizontalAlignment="Left" Margin="19.083,0.75,0,18.094" Stretch="Fill" Fill="#B2FFF500" Opacity="0" ToolTipService.ToolTip="Click me to light up your day."/> 
         </Grid> 
        </ControlTemplate> 
       </Setter.Value> 
      </Setter> 
     </Style> 
...snip...(Grid layout)  
<CheckBox Content="CheckBox" Style="{StaticResource CheckBoxStyle1}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Row="2" Name="CheckBox1" /> 
+0

글쎄, 솔직히, 왜 커야할지 모르겠다. –

+0

나도하지만 ViewBox에 넣지 마십시오. – Carlo

답변

1

크기는 더 폭 단지 이상에 의해 결정된다 신장. 또한 HorizontalAlignment, VerticalAlignment, 때로는 HorizontalContentAlignment, VerticalContentAlignment 등의 모든 정렬 설정과 요소를 정렬하는 데 사용되는 레이아웃 패널을 고려해야합니다. CheckBox를 왼쪽 정렬하면 필요한 최소 너비보다 큰 너비가 표시되지 않습니다. Grid XAML을 포함시키지 않았지만 CheckBox 행을 Height = "Auto"로 설정할 수 있다고 생각하지만 나머지 레이아웃을 보지 않고는 말할 수 없습니다.

+0

나중에이 스레드에 걸려 넘어지면 두 부분이 있습니다 : 1. 레이아웃에서 가로/세로 정렬 작업 방법을 읽으십시오. 2. 숫자가 아닌 별표 (*) 단위를 사용하여 채워지는 것을 확인하십시오. –

관련 문제