Search code examples
c#windows-runtimewinrt-xamlwinrt-async

How to show progress bar at application level in Win RT application?


I had two xaml pages like FirstPage.Xaml and SecondPage.Xaml .

On FirstPage.xaml I am generating pdf of all image recods by rendering image control available on my SecondPage.Xaml. What I am doing is I navigate to SecondPage.Xaml from FirstPage and then in SecondPage's LoadState method I update the image control with image record from my database table then rendered that image in BitmapeImage and saved it in a file, after saving image to file I closed the SecondPage by Frame.GoBack() method then write this image file to pdf.

For adding all the records in table to pdf I used above logic and it is working properly.

I am just need to show Progressbar at Application level that "PDF is Preparing" which will be appear at top of the application page navigation.

I tried adding Progressbar to FirstPage.xaml get Closed when it navigates to SecondPage.xaml

Please help me, "How to show progress bar at top of application which not closed beyond page navigation?".

Thanks In Advance.


Solution

  • There are two approaches in order to address this task

    1. First approach you can make a base page that will contain the progress bar then make FirstPage.xaml and SecondPage.xaml inherit from it and show/hide progress bar based on the logic you want.
    2. Second Approach if you are using MVVM(Model view view model) you can make a base class that contain property for show/hide progress bar then FirstPageViewModel and SecondPageViewModel should inherit this base class so that you will be able to show/hide progress bar from both viewModels

    Thanks.