【问题标题】:Access violation exception applicationbar访问冲突异常应用栏
【发布时间】:2014-03-05 21:43:26
【问题描述】:

我试图在启用和禁用属性的情况下操作我的应用栏中的按钮,但每次我得到一个异常告诉我系统访问冲突!对正在发生的事情有任何想法

 <phone:PhoneApplicationPage.ApplicationBar >
    <shell:ApplicationBar IsMenuEnabled="True" BackgroundColor="#989898"    ForegroundColor="White">
        <shell:ApplicationBarIconButton IconUri="/Images/APPBAR/Mes-infos-personnelles copie.png" x:Name="Profile_Button" IsEnabled="True" Text="Profile" />

        <shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarMenuItem   Text="Box" />

        </shell:ApplicationBar.MenuItems>

    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

在我的代码后面:

Profile_Button.IsEnabled = false;//exception here 

【问题讨论】:

  • 也发布一些代码..

标签: windows-phone-7 application-bar


【解决方案1】:

试试这个

((ApplicationBarIconButton) ApplicationBar.Buttons[0]).IsEnabled = false; // disables Profile_Button button

//禁用应用栏中的所有按钮和菜单项

  foreach (var button in ApplicationBar.Buttons)
       {
           ((ApplicationBarIconButton) button).IsEnabled = false;
       }

       //To prevent the menu from opening you have to use this code:
       ApplicationBar.IsMenuEnabled = false;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多