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 6877667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:37:41+00:00 2026-05-27T04:37:41+00:00

I am trying to add border in two pivot items. When my border is

  • 0

I am trying to add border in two pivot items.

When my border is added to grid in pivot item for the first time everything is working fine. But when i try to add border second time in same pivot item it throws an exception “The parameter is incorrect”
here is my code :

private void pivot_item1Loaded()
        {
            WebClient webClient2011 = new WebClient();
            string Url2011 = "http://hostname/Details/Images?year=2011" + "&time=" + System.DateTime.UtcNow;
            webClient2011.OpenReadAsync(new Uri(Url2011));

            webClient2011.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted2011);
        }

        private void pivot_item2Loaded()
        {
            WebClient webClient2012 = new WebClient();
            string Url2012 = "http://hostname/Details/Images?year=2012" +"&time="+ System.DateTime.UtcNow;
            webClient2012.OpenReadAsync(new Uri(Url2012));

            webClient2012.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted2012);
        }
        public void webClient_OpenReadCompleted2011(object sender, OpenReadCompletedEventArgs e)
        {
            StringBuilder output = new StringBuilder();
            try
            {               
                using (XmlReader reader = XmlReader.Create(e.Result))
                {

                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.Name == "iconPath")
                            {
                                string iconPath = reader.ReadElementContentAsString();
                                iconImages2011.Add(iconPath);
                            }
                            if (reader.Name == "imagePath")
                            {
                                string imagePath = reader.ReadElementContentAsString();
                                fullScreenImages2011.Add(imagePath);
                            }
                        }

                    }
                }

                int numOfRows = (iconImages2011.Count) / 3 + 1;
                for (int j = 0; j < numOfRows; j++)
                {
                    //pivot_item1 
                    ContentPanel2011.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(150) });
                }
                int rowCount = 0;
                int columnCount = 0;

                for (int i = 0; i < iconImages2011.Count; i++)
                {
                    Border border2011 = new Border();
                    border2011.Background = new SolidColorBrush(Colors.Blue);

                    border2011.Height = 110;
                    border2011.Width = 110;
                    border2011.CornerRadius = new CornerRadius(10);

                    Canvas canvas2011 = new Canvas();
                    canvas2011.Height = 110;
                    canvas2011.Width = 110;

                    BitmapImage AppImage = new BitmapImage(new Uri(iconImages2011[i], UriKind.Absolute));

                    Image img = new Image();
                    img.Source = AppImage;
                    img.Width = 90;
                    img.Height = 90;
                    img.Stretch = Stretch.Fill;
                    img.Margin = new Thickness(10, 10, 10, 10);
                    canvas2011.Children.Add(img);
                    border2011.Child = canvas2011;
                    border2011.Name = i.ToString();

                    Grid.SetColumn(border2011, columnCount);
                    Grid.SetRow(border2011, rowCount);

                    ContentPanel2011.Children.Add(border2011);

                    pivot2011.Content = ContentPanel2011;
                    if (columnCount < 2)
                    {
                        columnCount++;
                    }
                    else if (columnCount == 2)
                    {
                        columnCount = 0;
                        rowCount++;
                    }

                }

            }

            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }

        }

This code works for the first time but gives exception after that and ContentPanel2011 viz pivot_item1 do not get filled with border2011

  • 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-27T04:37:42+00:00Added an answer on May 27, 2026 at 4:37 am

    It is done.
    just set content property on pivots to null before before setting the content again.

    I have just added:

    pivot2011.Content = null;
    pivot2012.Content = null;
    

    in pivot_item1Loaded() and pivot_item2Loaded()

    and it is working fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a grid of items, with each item having a photo
I am trying to add a border att tha bottom of my textrured window
I am trying to add a curved border around an image downloaded and to
Trying to add a 'box' to a form at design time, I looked up
Im trying to add a directory foo to my repo, but there are some
I am trying to add a border and padding to the table row of
I am trying to add a bottom border to a div .divLast { top:
I'm trying to add an icon which sits on top of the border, splitting
I am trying to figure out how to add a border only inside the
I'm trying to add css styling to Facebook Like Box XFBML file but it

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.