App Bar...

Topics: UI Architecture
Jul 1, 2011 at 4:08 PM

So using View.Context property without having to hack something into (code behind), is there a way with the injection be able to switch out the appbar buttons dynamically?  Say on the new view being injected I wanted different buttons, how can I set them to the appbar.  I guess I am not seeing an easy way to template the appbar based on the view context.

I was able to get the app bar to show with programmatic approach with binding and the only thing does content control bubble the events with the model for the View.Model bound with {Binding}?  Cause at this point nothing hits.

//snippet....
ApplicationBar = {Binding AppBar}

//snippet
public class SyncViewModel : Screen{

   public SyncViewModel(){

     CurrentView = "_Default";
     BindAppBar();

   }

   private void BindAppBar(){

     switch(CurrentView.ToLower()){
     
       case "upload":   AssociatedMethod....
            break;
       case "download":   Associated....
            break:

     }

   }

   private void UploadAppBar(){
      //create appbar add a CaliburnButton... 

      //Notify....

   }    

   //Message for CM.AppBarButton...
   public void StartUploadSync() {  }

}

 

 

If there is a better approach please feel free to criticise... :)

 

Morgan.