Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6849515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:00:02+00:00 2026-05-27T01:00:02+00:00

I’m using a progress bar in my app, this progress bar is defined inside

  • 0

I’m using a progress bar in my app, this progress bar is defined inside the user control, e.g.:

UserControl x:Class="StirLibrary.ProgressBarControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
mc:Ignorable="d"  d:DesignHeight="800" d:DesignWidth="480">

<Grid x:Name="LayoutRoot" Height="800">
    <Border BorderThickness="2" BorderBrush="Transparent" Background="Transparent" Margin="50,522,50,158">
        <StackPanel>
            <TextBlock Text="Loading..." Name="loading" Grid.Row="1" HorizontalAlignment="Center" Height="30" Foreground="Green">
            </TextBlock>
            <ProgressBar Background="Transparent" Margin="10, 0, 0, 10" Height="80" HorizontalAlignment="Center" Name="progressBar1" VerticalAlignment="Top" Width="380" Grid.Row="2" HorizontalContentAlignment="Left" IsHitTestVisible="True" VerticalContentAlignment="Top" Value="0" Maximum="100">
            </ProgressBar>
        </StackPanel>
    </Border>
</Grid>
</UserControl>

My problem is when the orientation of my app changes to landscape the progress bar’s orientation doesn’t change and this makes the app look ugly. Any suggestions how to avoid this and make the progress bar displayed as per orientation are welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:00:03+00:00Added an answer on May 27, 2026 at 1:00 am

    As Matt has mentioned above it is not possible to orient a pop up in user control because User control doesn’t have any room for supported orientation. but since it was very crucial requirement for our App i found a work around and made few changes in the Main Page’s class file and the user control’s class file.. the changes are:

     private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
            {
                if ((e.Orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
                {
    ProgressBarControl.getInstance().ProgressBarControl_LayoutUpdated(this, e,e.Orientation.ToString());
    }
    else if ((e.Orientation & PageOrientation.Landscape) == PageOrientation.Landscape)
                {
    ProgressBarControl.getInstance().ProgressBarControl_LayoutUpdated(this, e, e.Orientation.ToString());
    }
    }
    

    These are the changes in MainPage.xaml.cs

    public partial class ProgressBarControl : UserControl
    {
        private static ProgressBarControl instance = null;
        public static Popup popup;
    
        private ProgressBarControl()
        {
            InitializeComponent();
        }
        public static ProgressBarControl getInstance()
        {
            if (instance == null)
            {
                instance = new ProgressBarControl();
                popup = new Popup();
                popup.Child = instance;
                popup.IsOpen = false;
            }
            return instance;
        }
        public void ProgressBarControl_LayoutUpdated(object sender, EventArgs e,string orientation)
        {
            if (orientation == "LandscapeRight")
            {
                ProgressPanel.RenderTransformOrigin = new Point(0.5, 0.5);
                ProgressPanel.RenderTransform = new CompositeTransform { Rotation = 270 };
            }
            else if(orientation == "LandscapeLeft")
            {
                ProgressPanel.RenderTransformOrigin = new Point(0.5, 0.5);
                ProgressPanel.RenderTransform = new CompositeTransform { Rotation = 90 };
            }
            else
            {
                ProgressPanel.RenderTransformOrigin = new Point(0, 0);
                ProgressPanel.RenderTransform = new CompositeTransform { Rotation = 0 };
            }
    
        }
    
        public static void displayProgressBar(int requestId, int status, string msg)
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    if (instance == null)
                    {
                        instance = new ProgressBarControl();
                        popup = new Popup();
                        popup.Child = instance;
                    }
                    popup.IsOpen = true;
                    instance.loading.Text = msg;
                    instance.progressBar1.IsIndeterminate = true;
                    instance.progressBar1.Value = status;
                });
        }
        public static void dismissProgressBar()
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    if(popup!=null)
                    {
                        popup.IsOpen = false;
                    }
                });
        }
    }
    

    and this what i have done in my ProgressBarControl.cs file (this is the user control’s class file)

    Xaml file:

    <UserControl x:Class="StirLibrary.ProgressBarControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    mc:Ignorable="d"  d:DesignHeight="800" d:DesignWidth="480">
    
    <Grid x:Name="LayoutRoot" Height="800">
        <!--<Border BorderThickness="2" BorderBrush="Black" Background="Transparent" Margin="54,406,50,320"></Border>-->
        <StackPanel x:Name="ProgressPanel" Background="Black" Margin="54,406,50,320">
            <TextBlock Text="Loading..." Name="loading" Grid.Row="1" HorizontalAlignment="Center" Height="32" Foreground="White"></TextBlock>
            <ProgressBar Background="Green" Margin="10, 0, 0, 10" Height="33" Foreground="White" HorizontalAlignment="Center" Name="progressBar1" VerticalAlignment="Top" Width="351" Grid.Row="2" HorizontalContentAlignment="Left" IsHitTestVisible="True" VerticalContentAlignment="Top" Value="0" Maximum="100"></ProgressBar>
        </StackPanel>
    </Grid>
    </UserControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.