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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:32:20+00:00 2026-05-20T18:32:20+00:00

Why is my ApplicationBarIconButton null? <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible=True IsMenuEnabled=True x:Name=appBar> <shell:ApplicationBarIconButton x:Name=appbarSave IconUri=/Icons/appbar.save.rest.png Text=Save

  • 0

Why is my ApplicationBarIconButton null?

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" x:Name="appBar">
        <shell:ApplicationBarIconButton x:Name="appbarSave"
          IconUri="/Icons/appbar.save.rest.png Text="Save" IsEnabled="False"
          Click="appbarSave_Click" />
    </shell:Application Bar>
</phone:PhoneApplicationPage.ApplicationBar>

The appBarSave object is null, and trying this:

Initialize Component();
appbarSave.IsEnabled = true;

Results in a NullReferenceException. The only place the object works is in the click event (if I enable it):

private void appbarSave_Click(object sender, EventArgs e)
{
    ApplicationBarIconButton button = (ApplicationBarIconButton)sender;
    button.IsEnabled = false;
}

I would really like to be able to start the save button as disabled and enabled it later.

  • 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-20T18:32:21+00:00Added an answer on May 20, 2026 at 6:32 pm

    I remember running into this issue before: there’s an explanation here. An easy workaround is just to instantiate it in code-behind rather than xaml (like here).

    private ApplicationBarIconButton SaveEdit;
    private void InitAppBar()
    {
         ApplicationBar appBar = new ApplicationBar();
    
         SaveEdit = new ApplicationBarIconButton(new Uri("images/appbar.check.rest.png", UriKind.Relative));
         SaveEdit.Click += new EventHandler(OnClick_Check);
         SaveEdit.Text = Strings.Save_button;
         appBar.Buttons.Add(SaveEdit);
    
         ApplicationBarIconButton CancelEdit = new ApplicationBarIconButton(new Uri("images/appbar.close.rest.png", UriKind.Relative));
         CancelEdit.Click += new EventHandler(OnClick_Cancel);
         CancelEdit.Text = Strings.Cancel_button;
         appBar.Buttons.Add(CancelEdit);
    
         ApplicationBar = appBar;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm developing a Windows Phone 7.1 Application, this is the ApplicationBar : <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar
public MainPage() { InitializeComponent(); ApplicationBar = new ApplicationBar(); ApplicationBar.Opacity = 1.0; ApplicationBar.IsVisible = true;
I have a TextBox in my app, and an ApplicationBarIconButton in the ApplicationBar which
I'm developing my first Windows Phone 7 application and I have to add an
I've created a custom icon for the ApplicationBarIconButton. I would like to use it
Now I'm developing a Windows Phone 7 app, my app has three buttons located
I'm developing a Windows Phone 7.1 application. I have the following folders structure: -
I have a Windows Phone 7.1 Mango application where I have mostly successfully overridden
It is most probably a stupid mistake, but can anyone tell me why my
I am attempting to add items to an application bar with behavoirs. In xaml

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.