This project is read-only.

[SOLVED] IsEnabled not working in version 2.4

Jun 26, 2013 at 5:10 PM
Hello,
<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar>
        <shell:ApplicationBarIconButton Text="refresh" IconUri="/Assets/AppBar/appbar.sync.rest.png" />
        <shell:ApplicationBarIconButton Text="capture" IconUri="/Assets/AppBar/appbar.feature.camera.rest.png"/>
        <shell:ApplicationBarIconButton Text="share  " IconUri="/Assets/AppBar/share.png"/>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

<i:Interaction.Triggers>
    <AppBarUtils:AppBarItemTrigger Type="Button" 
                                   IsEnabled="{Binding UI.Appbar_EnableRefreshButton}"
                                   Text="refresh"
                                   />
    <AppBarUtils:AppBarItemTrigger Type="Button" 
                                   IsEnabled="{Binding UI.Appbar_EnableCaptureButton}"
                                   Text="capture"
                                   />
    <AppBarUtils:AppBarItemTrigger Type="Button" 
                                   IsEnabled="{Binding UI.Appbar_EnableShareButton}"
                                   Text="share  "
                                   />
</i:Interaction.Triggers>
that's my XAML code up there and here's the VM code
public class ViewModel_UIController : ViewModelBase
{
    private bool _Appbar_EnableRefreshButton = false;
    public bool Appbar_EnableRefreshButton
    {
        get { return _Appbar_EnableRefreshButton; }
        set
        {
            if (_Appbar_EnableRefreshButton != value)
            {
                _Appbar_EnableRefreshButton = value;
                base.RaisePropertyChanged("Appbar_EnableRefreshButton");
            }
        }
    }

    private bool _Appbar_EnableShareButton = false;
    public bool Appbar_EnableShareButton
    {
        get { return _Appbar_EnableShareButton; }
        set
        {
            if (_Appbar_EnableShareButton != value)
            {
                _Appbar_EnableShareButton = value;
                base.RaisePropertyChanged("Appbar_EnableShareButton");
            }
        }
    }

    private bool _Appbar_EnableCaptureButton = false;
    public bool Appbar_EnableCaptureButton
    {
        get { return _Appbar_EnableCaptureButton; }
        set
        {
            if (_Appbar_EnableCaptureButton != value)
            {
                _Appbar_EnableCaptureButton = value;
                base.RaisePropertyChanged("Appbar_EnableCaptureButton");
            }
        }
    }

    public ViewModel_UIController()
    {
        this.Appbar_EnableCaptureButton = false;
        this.Appbar_EnableRefreshButton = true;
        this.Appbar_EnableShareButton = false;
    }
}
and here's my ViewModelLocator
public class ViewModelLocator
{
    /// <summary>
    /// Initializes a new instance of the ViewModelLocator class.
    /// </summary>
    public ViewModelLocator()
    {
        ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

        SimpleIoc.Default.Register<MainViewModel>();
        SimpleIoc.Default.Register<ViewModel_UIController>();
    }

    public MainViewModel Main
    {
        get
        {
            return ServiceLocator.Current.GetInstance<MainViewModel>();
        }
    }

    public ViewModel_UIController UI
    {
        get
        {
            return ServiceLocator.Current.GetInstance<ViewModel_UIController>();
        }
    }
    
    public static void Cleanup()
    {
        // TODO Clear the ViewModels
    }
}
I have an application that it's been days that I stopped developing due to this toolkit not wokring properly. Today, I made a test, and I am not sure what's missing why IsEnabled is not working
Jun 27, 2013 at 3:05 PM
ok solved. ID was missing.
Aug 24, 2013 at 3:13 PM
I have a similar problem using StateChangedTrigger (Version 2.4). The text and command bindings are workling perfectly but the action is never disabled even if I set it to false directly without binding.
Can anyone help me please?
    <!--APPBAR-->
    <i:Interaction.Triggers>
        <abu:StateChangedTrigger State="{Binding AppBarState}">
            <abu:SwitchAppBarAction>

                <!--STATE: ADD-->
                <abu:AppBar Id="10">
                <!--SAVE ACTION-->
                    <abu:AppBarButton IconUri="/Resources/Images/appbar.save.rest.png" IsEnabled="{Binding SaveActionEnabled}" Command="{Binding SaveCommand}" 
                 Text="{Binding LocalizedResources.Common_Save, Mode=OneWay, Source={StaticResource LocalizedStrings}}"/>
               
                </abu:AppBar>

       
                <abu:AppBar Id="0">
                ... More Actions
               </abu:AppBar>
                  
         
                  

            </abu:SwitchAppBarAction>
        </abu:StateChangedTrigger>
    </i:Interaction.Triggers>