我是Windows Phone 8開發新手,我有一個非常基本的問題,我相信。LongListSelector根據屏幕寬度調整
我希望使我的LongListSelector有100%的寬度和高度,但所有我已經嘗試過的東西沒有工作。
我試過自動,*等,但似乎沒有做到這一點。
這裏是我的代碼:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock TextWrapping="Wrap" Text="{Binding Path=LocalizedResources.SetupsPageTitle, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector HorizontalAlignment="Left" Width="400" Height="400"
VerticalAlignment="Top"
Name="lstSetups" ItemsSource="{Binding BusRouteSetups}"
SelectionChanged="lstSetups_SelectionChanged"
LayoutMode="List">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Margin="0,10,0,10" Background="Coral">
<TextBlock TextWrapping="Wrap" Margin="5" FontWeight="Bold" Text="{Binding Details.Title}" />
<TextBlock TextWrapping="Wrap" Margin="5" Text="{Binding Details.Description}" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</Grid>
任何幫助將非常感激。
您已將'LongListSelector'的'Width'屬性設置爲'400',它將永遠不會比這更寬...... –
我已設置寬度和高度,以便我可以使用它直到找到一個辦法。 – panais
然後請張貼代碼來重現問題。 –