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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:42:33+00:00 2026-06-02T09:42:33+00:00

I want to change the icons and what they do in code in my

  • 0

I want to change the icons and what they do in code in my WP7 application. I’ve tried in the MainPage constructor and in the MainPage_Loaded but it says ApplicationBar (x:Name) is null all the time.

How can I change it since I use same page and different states?

  • 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-06-02T09:42:42+00:00Added an answer on June 2, 2026 at 9:42 am

    Unfortunately the application bar buttons are not accessible via code at the moment. I followed one of the examples of the official Mircosoft Training Kit for WP7 to accomplish that task. Here is the XAML and some code:

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar>
            <shell:ApplicationBarIconButton IconUri="/icons/appbar.pin.png" IsEnabled="True" Text="Anpinnen" x:Name="appPinPage" Click="appPinPage_Click" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    

    Please note that ApplicationBar is a property of PhoneApplicationPage so that you do not have to give an explicit name to the ApplicationBar object that you assign to the ApplicationBar property of the PhoneApplicationPage. Here is an example of changing the picture of the button in the xaml code above. That code is called in the overridden OnNavigatedTo() method of the PhoneApplicationPage.

            if (this.ViewModel.IsPinned())
            {
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).Text = Resource1.txtUnpin;
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IconUri = new Uri("/icons/appbar.unpin.png", UriKind.Relative);
            }
            else
            {
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).Text = Resource1.txtPin;
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IconUri = new Uri("/icons/appbar.pin.png", UriKind.Relative);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup file of winform. but i want to change my icon how
I want to change the app typeface and I can't: AndroidManifest.xml ... <application android:icon=@drawable/ic_launcher
I want change following javascript code to jquery code, How is it? With done
I have an ActionBar with mode ActionBar.NAVIGATION_MODE_TABS , I want to change icons which
I want to change Copy and Paste Icons in Windows Phone 7 and also
I want to change the order of the navigation button icons for the add,
I have an ImageButton which I want to change the NAME attribute of in
I have a tree panel in an ExtJS4 application and I want to change
Our designers want to change the color of the default UITabBar. Of course they
I want to change the control panel icon when I create a setup in

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.