title: MVVMCross Fragment and dynamically setting event commands
body: <p>I have a MvxFragment that is bound to a view model that has two ICommand properties defined. This fragment contains an MvxListView and can be part of different activities/layouts dependant on the device size/orientation.</p>
  
  <p>What I want to know is how to specify the ItemClick event command of the MvxBind property of the MvxListView dynamically or is there a better way to handle this use case? Should I use a separate fragment?</p>
  
  <p>A similar use case to the one I am trying to achieve is within the Overview section of this <a href="https://developer.xamarin.com/guides/android/platform_features/fragments/fragments_walkthrough/" rel="nofollow">Xamarin Dev Guide</a></p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:local="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
      &lt;MvxListView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          local:MvxBind="ItemsSource Courses; ItemClick Comamnd1"
          local:MvxItemTemplate="@layout/coursetemplate" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>ViewModel (Simpified)</strong></p>
  
  <pre><code>public class MyViewModel : MvxViewModel
  {
      private MvxCommand&lt;MyMessage&gt; messageCommand;
  
      public MyViewModel (IMvxMessenger messenger, IHttpClientBuilderService httpClientBuilder)
      {
          this.httpClientBuilder = httpClientBuilder;
          this.messenger = messenger; 
      }
  
      public ICommand Comamnd1 {
          get { return new MvxCommand&lt;Course&gt; ((c) =&gt; ShowViewModel&lt;MyOtherViewModel&gt;(c)); }
      }
  
      public ICommand Command2 {
          get 
          { 
              messageCommand = messageCommand ?? new MvxCommand&lt;MyMessage&gt;(c =&gt; 
                  {
                      var message = new MyMessage(this, c);
                      messenger.Publish(message);                     
                  }); 
              return selectedCourse;
          }
      }
  
  }
  </code></pre>