1

为什么 XAML 被标记为无效的<DataTemplate>... </DataTemplate>?该项目虽然编译正确。

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

在当前项目中,我使用“WPtoolkit”版本="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-->
                ............
4

0 回答 0