Fluent ApplicationBar

This library allows you to bind application bar buttons to methods in ViewModel. Supports enabling disabling via guard property. Also you can easily rebnid buttons in your appbar if you need (for example page with pivot can have different appbars)

Markup: (only visual, without event handlers)
<shell:ApplicationBar BackgroundColor="{StaticResource AvitoApplicationBarColor}"
                      ForegroundColor="White">
            <shell:ApplicationBarIconButton IconUri="/Resources/Icons/Checkmark.png" Text="apply" IsEnabled="False"/>
            <shell:ApplicationBarIconButton IconUri="/Resources/Icons/ResetFilter.png" Text="clear" />
</shell:ApplicationBar>


Page code behind:
private void PageOnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
    AppBar.Setup<FilterPageViewModel>(this)
          .First((btn, vm) => vm.Ready(), vm => !vm.IsLoadingInProgress)
          .Second((btn, vm) => vm.Reset());
}


Viewmodel:
public class FilterPageViewModel : INotifyPropertyChanged
{
    public bool IsLoadingInProgress
    {
        get
        {
            return _isLoadingInProgress;
        }
        set
        {
            _isLoadingInProgress = value;
            NotifyOfPropertyChange(() => IsLoadingInProgress);
        }
    }

    public void Ready()
    {
        // ...
    }
	
    public void Reset()
    {
        // ...
    }
}

Last edited Jul 11, 2013 at 1:11 PM by BelorusBY, version 3