C# 框架不使用框架模板内带有ProgressBar的工具箱转换

C# 框架不使用框架模板内带有ProgressBar的工具箱转换,c#,xaml,windows-phone-7,C#,Xaml,Windows Phone 7,我正在切换到在应用程序框架中使用进度条/网格,而不是通过弹出窗口。我使用此堆栈溢出帖子使其正常工作: 但是,当使用该示例时,我不再有页面转换。如果页面转换不能正常工作,我将很难保证使用它。有什么我遗漏的吗?我尝试将TargetType设置为“TransitionFrame”,但这无法正常工作,并引发XAML解析异常(对于命名空间Microsoft.Phone.Controls.PhoneApplicationPages) 如果将progressbar放在帧上,然后设置页面动画,则动画将不包括pr

我正在切换到在应用程序框架中使用
进度条
/
网格
,而不是通过
弹出窗口
。我使用此堆栈溢出帖子使其正常工作:

但是,当使用该示例时,我不再有页面转换。如果页面转换不能正常工作,我将很难保证使用它。有什么我遗漏的吗?我尝试将TargetType设置为“
TransitionFrame
”,但这无法正常工作,并引发
XAML
解析异常(对于命名空间
Microsoft.Phone.Controls.PhoneApplicationPages


如果将progressbar放在帧上,然后设置页面动画,则动画将不包括progressbar


为什么不将进度条放在页面上?

要使用工具箱的TransitionFrame进行页面转换以及使用自定义控件模板来显示进度条,必须将控件模板的TargetType指定为
Toolkit:TransitionFrame
,其中Toolkit定义为:

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
问题的其余部分是ControlTemplate没有指定
TransitionFrame
所需的模板部分。它需要两个类型为
ContentPresenter
的部分,分别命名为FirstContentPresenterSecondContentPresenter。将ControlTemplate更改为以下内容以恢复页面转换:

        <ControlTemplate x:Key="LoadingIndicatorTemplate" TargetType="toolkit:TransitionFrame">
            <Grid x:Name="ClientArea">
                <ContentPresenter x:Name="FirstContentPresenter" />
                <ContentPresenter x:Name="SecondContentPresenter" />
                <Grid x:Name="ProgressGrid"
                      Background="Black"
                      Opacity="0.85"
                      Visibility="Collapsed"
                      Loaded="ProgressGrid_Loaded">
                    <StackPanel x:Name="Loading"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center"
                                Margin="10">
                        <TextBlock x:Name="tbLoading"
                                   HorizontalAlignment="Center"
                                   Text="Loading"
                                   Style="{StaticResource BoaTextNormalStyle}" />
                        <toolkit:PerformanceProgressBar x:Name="pbLoading"
                                                        HorizontalAlignment="Center"
                                                        Width="400"
                                                        Margin="10"
                                                        IsIndeterminate="False" />
                    </StackPanel>
                </Grid>
            </Grid>
        </ControlTemplate>


注意:Jeff Wilcox的
PerformanceProgressBar
现在是Silverlight工具包的一部分,因此您可以直接使用它,如上所示。

动画根本不会发生。我不想让进度条出现在页面上,因为它可以出现在应用程序的30多个页面上。@willmel:30多个页面的应用程序看起来像是导航噩梦。我以前尝试过这段代码,但问题仍然是一样的。还有什么我可以尝试的吗?因此,使用正确类型的ControlTemplate和正确的XMLN,您不会得到XamlParseException,您会得到进度条,但不会得到页面转换?是的。进度条可以很好地显示,就像所有页面一样,但是实际的页面转换不再存在。我已经用实际的ControlTemplate更新了原始帖子。问题是缺少模板部分。我已经用完整的解决方案更新了我的答案。谢谢!这就是我错过的。非常感谢。
        <ControlTemplate x:Key="LoadingIndicatorTemplate" TargetType="toolkit:TransitionFrame">
            <Grid x:Name="ClientArea">
                <ContentPresenter x:Name="FirstContentPresenter" />
                <ContentPresenter x:Name="SecondContentPresenter" />
                <Grid x:Name="ProgressGrid"
                      Background="Black"
                      Opacity="0.85"
                      Visibility="Collapsed"
                      Loaded="ProgressGrid_Loaded">
                    <StackPanel x:Name="Loading"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center"
                                Margin="10">
                        <TextBlock x:Name="tbLoading"
                                   HorizontalAlignment="Center"
                                   Text="Loading"
                                   Style="{StaticResource BoaTextNormalStyle}" />
                        <toolkit:PerformanceProgressBar x:Name="pbLoading"
                                                        HorizontalAlignment="Center"
                                                        Width="400"
                                                        Margin="10"
                                                        IsIndeterminate="False" />
                    </StackPanel>
                </Grid>
            </Grid>
        </ControlTemplate>