开发者

How to bind SystemTray Progressbar to a property in selected PivotItem DataContext

开发者 https://www.devze.com 2023-04-12 20:40 出处:网络
I got an app with a Pivot and 3 PivotItems. Each PivotItem has its own DataContext, and the DataContext has a property named IsLoading.

I got an app with a Pivot and 3 PivotItems. Each PivotItem has its own DataContext, and the DataContext has a property named IsLoading.

It is possible to bind the SystemTray.ProgressIndicator IsVisible property to the selected pivotitem DataContext.IsLoading property?

Here is What I tryied:

<shell:SystemTray.ProgressIndicator>
    <shell:ProgressIndicator 
       IsVisible="{Binding ElementName=pivot, Path=SelectedItem.DataContext.IsLoading}" />
</shell:SystemTray.ProgressIndicator>
<Grid Background="Transparent">
    <controls:Pivot x:Name="pivot">

        <controls:P开发者_如何学JAVAivotItem Header="pivot item"
                                Margin="0,28,24,0"
                                DataContext="{Binding DCOne}" />

        <controls:PivotItem Header="pivot item"
                            Margin="0,28,24,0"
                            DataContext="{Binding DCTwo}" />

        <controls:PivotItem Header="pivot item"
                            Margin="0,28,24,0"
                            DataContext="{Binding DCThree}" />
</Grid>


Try this:

http://www.codeproject.com/Articles/246355/Binding-the-WP7-ProgressIndicator-in-XAML?display=Print

<a:ProgressIndicatorProxy IsVisible="{Binding ElementName=pivot, Path=SelectedItem.DataContext.IsLoading}" />

(haven't tried it)


Here's a solution from Jeff Wilcox that looks like it will work for your situation:

http://www.jeff.wilcox.name/2011/07/creating-a-global-progressindicator-experience-using-the-windows-phone-7-1-sdk-beta-2/

You could adapt the technique to directly address the ProgressIndicator on your pivot page based on the states of the other (or selected) pivot items.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号