Search code examples
windows-phone-8

while progress bar is running how to disable other controls of the page in WPF


How can i have a loading/progress bar on the page while it is taking time to call a service,also until the call and response is not complete the controls should not be accessible


Solution

  • Try this way, Create a empty grid behind the Progress Bar that cover the whole screen and set its opacity of say 0.5 so that background is paritially visible.

    <Grid Grid.Row="0" x:Name="GrdProgressBar"  Background="Transparent"  >
            <Grid Background="White" Opacity="0.5"></Grid>
            <StackPanel VerticalAlignment="Center">
                <ProgressBar IsIndeterminate="True" Foreground="Green" Margin="0,5,0,0" ></ProgressBar>
                <TextBlock Text="loading.." FontSize="20"  FontStyle="Italic" Foreground="Black"  HorizontalAlignment="Center" ></TextBlock>
            </StackPanel>
     </Grid>
    

    What you have to done set the visibility of `GrdProgressBara as you do with ProgessBar.

    Hope it help you :)