2011-02-18 3 views
2

안녕하세요 저는 ListView있는 GridView보기WPF ListView 열은 시간의 너비를 업데이트하지 않습니다.

그리고 그 안에 몇 가지 GridViewColumn 있어요 최대 열의 크기를 원하는 열의 너비를 ..하지만이 작동하지 않는, 보인다 databind는 열 크기를 업데이트하지 않고 대신 이전 databind의 가장 큰 항목을 사용합니다.

레이아웃을 수정하는 몇 가지 스타일이 있습니다.

<Style TargetType="{x:Type ListView}"> 
    <Setter Property="BorderThickness" Value="1.000001"/> 
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/> 
    <Setter Property="BorderBrush" Value="{x:Null}"/> 
    <Setter Property="Background" Value="Transparent"/> 
</Style> 
<Style TargetType="ListViewItem"> 
    <Style.Resources> 
     <!-- Foreground for Selected ListViewItem --> 
     <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" 
           Color="Black"/> 
     <!-- Background for Selected ListViewItem --> 
     <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" 
           Color="Transparent"/> 

     <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> 
    </Style.Resources> 
</Style> 
<Style TargetType="{x:Type GridViewColumnHeader}"> 
    <Setter Property="Background" Value="{StaticResource PrimaryBrush}" /> 
    <Setter Property="Foreground" Value="White" /> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="{x:Type GridViewColumnHeader}"> 
       <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Margin="2,0"> 
        <Rectangle x:Name="normal" /> 

        <ContentPresenter x:Name="HeaderContent" 
             HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
             Margin="5" 
             RecognizesAccessKey="True" 
             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
             VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> 
       </Grid> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 

wpf가이 방식으로 작동하는 이유는 무엇입니까? 어떤 해결책이 있습니까?

답변

관련 문제