为什么这个ListBox XAML无效?

时间:2013-02-14 14:27:40

标签: c# xaml listbox windows-phone-8

为什么仅<DataTemplate>... </DataTemplate>之间的XAML标记为无效?该项目虽然汇编得很好。

之前我在另一个使用Windows Phone工具包SilverlightToolkitWP“version =”4.2012.6.25“targetFramework =”wp80“的项目中使用了此代码,其中没有任何问题,其中使用了工具包:PerformanceProgressBar而不是ProgressBar控件。

在当前项目中,我正在使用“WPtoolkit”version =“4.2012.10.30”targetFramework =“wp80”。但是当前页面上没有使用工具包控件。

<phone:PhoneApplicationPage
x:Class="Game.ScoreBoards"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.WindowsPhone"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait"  Orientation="Portrait"
shell:SystemTray.IsVisible="True"
Style="{StaticResource TransitionPageStyle}">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot">
    <Grid.Background>
        <ImageBrush Opacity="0.5" ImageSource="{Binding BestResolutionScoreImage, Source={StaticResource MultiResImageChooser}}"/>
    </Grid.Background>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid Grid.Row="0">

        <!--Pivot Control-->
        <phone:Pivot Title="ONLINE SCOREBOARDS" x:Name="pivScoreboard" SelectionChanged="pivScoreboard_SelectionChanged">                                
            <!--Pivot item very easy-->
                <phone:PivotItem Header="very easy">
                <Grid Margin="12,0,12,0">
                    <StackPanel>
                        <ProgressBar x:Name="progressBar0" IsIndeterminate="True" />
                        <ListBox x:Name="ScoreList0" Height="450" Margin="0,20,0,0">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid HorizontalAlignment="Stretch">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="45"/>
                                            <ColumnDefinition />
                                            <ColumnDefinition Width="210"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Margin="0,0,10,0" Text="{Binding no, StringFormat='\{0\}.'}" 
                                           Foreground="{Binding deviceid, Converter={StaticResource FontForegroundConverter}}"
                                           FontWeight="{Binding deviceid, Converter={StaticResource FontWeightConverter}}"
                                           Grid.Column="0"/>
                                        <Image Margin="0,0,10,0" Width="32" Height="32" Source="{Binding country, Converter={StaticResource CountryToFlagConverter}}" Grid.Column="1"/>
                                        <TextBlock Margin="0,0,10,0"  Text="{Binding name}"
                                            Foreground="{Binding deviceid, Converter={StaticResource FontForegroundConverter}}"
                                            FontWeight="{Binding deviceid, Converter={StaticResource FontWeightConverter}}"
                                            Grid.Column="2"/>
                                        <TextBlock Margin="0,0,10,0"  Text="{Binding score}" 
                                            Foreground="{Binding deviceid, Converter={StaticResource FontForegroundConverter}}"
                                            FontWeight="{Binding deviceid, Converter={StaticResource FontWeightConverter}}"
                                            Grid.Column="3"/>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                 </Grid>
            </phone:PivotItem>

                <!--Pivot item easy-->
                ............

0 个答案:

没有答案