반응형
ListViewItem은 ListView의 너비로 늘어나지 않습니다.
현재 XAML을 사용하여 Windows 8 스토어 앱을 디자인하고 있지만 사소한 크기 문제가 있습니다. DataTemple이있는 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 스토어 앱을 개발하고 있습니다.
ListView 정의에 다음을 추가하십시오.
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
참고 URL : https://stackoverflow.com/questions/15067309/listviewitem-wont-stretch-to-the-width-of-a-listview
반응형
'code' 카테고리의 다른 글
텍스트를 클릭하여 해당 라디오 버튼 선택 (0) | 2020.10.09 |
---|---|
Scala 컴파일에서 java.lang.OutOfMemoryError : PermGen 공간을 방지하는 방법은 무엇입니까? (0) | 2020.10.09 |
CouchDB에서 트랜잭션과 잠금을 할 수 있습니까? (0) | 2020.10.09 |
Windows의 Python os.path.join (0) | 2020.10.09 |
AFNetworking으로 시간 제한을 설정하는 방법 (0) | 2020.10.09 |