Home > DeveloperSection > Forums > Disabling ApplicationBarIconButton in wp7
Manoj Bhatt
Manoj Bhatt

Total Post:154

Posted on    January-29-2014 11:34 PM

 C# C# 

 1 Reply(s)
 972  View(s)
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

Pravesh Singh

Total Post:412

Posted on    January-29-2014 11:52 PM

Hi Manoj,

Use like that

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

 myAppIconButton .IsEnabled = false;

And you will disable it.

Don't want to miss updates? Please click the below button!

Follow MindStick