DISABLING APPLICATIONBARICONBUTTON IN WP7

Manoj Bhatt

Total Post:154

Points:1086
Posted by  Manoj Bhatt
C# 
C#
 989  View(s)
Ratings:
Rate this:

I've two applicationbariconbuttons, out of which one is to be enabled only if certain conditions are met. My Code in C#

if (//conditions)

  {

     ((ApplicationBarIconButton)DeleteButton).IsEnabled = false;

  }

But while excecution, i get the following error,

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll

Help me to solve this one.

Thanks in advance
  1. Pravesh Singh

    Post:412

    Points:2888
    Re: Disabling ApplicationBarIconButton in wp7

    Hi Manoj,


    Use like that

     ApplicationBarIconButton myAppIconButton = (ApplicationBarIconButton)ApplicationBar.Buttons[0];

     myAppIconButton .IsEnabled = false;

    And you will disable it.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!