Question

Well then , I got something like this in my manipange.xaml , my application bar declaration, and my button declaration/definition

<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar x:Name="xxxx" IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton
                x:Name="appBarRegisterButton"
                IconUri="/Images/next.png"
                Text="Login"
                Click="appBarRegisterButton_Click_1" IsEnabled="True"/>
            </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

when i try to change some property from some other model, fe. this is my registartion Model.

   public RegisterViewModel()
    {
        RegisterTitle = Resources.AppResources.RegisterTitle;
        Messenger.Default.Register<RegisterButtonPressed>(this, msg => AttemptToRegister(msg.reg));
    }


    private void AttemptToRegister(Register reg)
    {
        reg.appBarRegisterButton.IsEnabled = true;
     }

It does not change,better my register button is a null object, anyone got a point how to solve this? ;/

Was it helpful?

Solution

You have to access the button like this:

var applicationBarIconButton = ApplicationBar.Buttons[0] as ApplicationBarIconButton;
if (applicationBarIconButton != null)
      {
//do stuff
}

The index depending on where it is located in the appbar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top