2013-02-25 1 views
75

현재 XAML을 사용하여 Windows 8 상점 앱을 디자인하고 있지만 사소한 크기 문제가 있습니다. DataTemple ListView 있습니다.ListViewItem이 ListView의 너비만큼 늘어나지 않습니다

내 ListView에 & DataTemplate을위한 코드는 다음과 같습니다 :

<ListView x:Name="listPageItems" 
      Grid.Row="1" 
      SelectionMode="Extended" 
      IsSwipeEnabled="False" 
      ItemsSource="{Binding Mode=OneWay, Source={StaticResource items}}" 
      ItemTemplate="{StaticResource NavigationItemTemplate}" 
      ScrollViewer.VerticalScrollBarVisibility="Visible"> 

</ListView> 

<DataTemplate x:Key="NavigationItemTemplate">  
     <Grid Height="75"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="1.6*" /> 
       <RowDefinition Height="*" /> 
      </Grid.RowDefinitions> 
      <Rectangle Fill="White" /> 
      <Rectangle Fill="{StaticResource SSEGreenBrush}" 
         Grid.Row="1" /> 
      <Border BorderThickness="2" 
        BorderBrush="{StaticResource SSEGreenBrush}" 
        Grid.RowSpan="2" /> 
      <TextBlock x:Name="textTitle" 
         Text="{Binding ClientName}" 
         Style="{StaticResource TitleTextStyle}" 
         Foreground="{StaticResource SSEBlueBrush}" 
         Margin="10,5,5,5" /> 
      <StackPanel Orientation="Horizontal" 
         Grid.Row="1" 
         HorizontalAlignment="Stretch"> 
       <TextBlock Text="Last Edit :" 
          Style="{StaticResource SubtitleTextStyle}" 
          Foreground="{StaticResource SSEBlueBrush}" 
          Margin="3,0,0,3" 
          VerticalAlignment="Center" /> 
       <TextBlock Text="SurveyDate" 
          Style="{StaticResource SubtitleTextStyle}" 
          Foreground="{StaticResource SSEBlueBrush}" 
          Margin="3,0,0,3" 
          VerticalAlignment="Center" /> 
      </StackPanel> 
     </Grid> 
    </DataTemplate> 

뷰가 표시 될 때,리스트 뷰는 240

의 고정 폭 그리드 열 내에있는 ListViewItems 스트레칭하지 않습니다 ListView의 너비에 맞 춥니 다. 내가 HorizontalContentAlignment 등 다양한 속성을 설정했는데 ListViewItem을 늘릴 수 없어!

아무도 도와 줄 수 있습니까?

미리 감사드립니다.

Visual Studio 2012, C# 4.5를 사용하고 Windows 스토어 앱을 개발 중입니다. BindingExpression 경로 오류 :

답변

186

를 추가해보십시오 당신의 ListView에 정의에

<ListView.ItemContainerStyle> 
    <Style TargetType="ListViewItem"> 
     <Setter Property="HorizontalContentAlignment" Value="Stretch" /> 
    </Style> 
</ListView.ItemContainerStyle> 
+1

오류를 다음의 '폭'속성은 중립 Project.CustomElement, Project.WindowsPhone, 버전 = 1.0.0.0, 문화 =, PublicKeyToken을 찾을 수 없습니다 = null '. BindingExpression : Path = '너비'DataItem = Project.CustomElement, Project.WindowsPhone, 버전 = 1.0.0.0, 문화 = 중립, PublicKeyToken = null '; 대상 요소는 'Windows.UI.Xaml.Controls.Grid'(Name = 'null')입니다. 대상 속성이 '너비'(유형 'Double')입니다. –

+0

많은 도움이됩니다. 감사합니다 내 표 +1 – imdadhusen

+0

그것은 나를 위해 일했습니다. 고마워. +1 – arundevma

관련 문제