How to set Binding Context of ListView button to the binding context of parent in Xamarin Forms
<p>Basically, I have a ListView with a DataTemplate Selector that uses a particular DataTemplate basing on the ListView item.</p>

<p>Now, in the DataTemplate - I have a button w/ a command that should be binded on the ViewModel of the Parent (or the ListView) itself.</p>

<p>Note that I only want to bind the Command property of the button as the Text and other properties would need to be binded to the current binding Context of the button.</p>

<p>The BindingContext of the DataTemplate is the ListView Item bindingContext (Message Model in this case) but I want to be able to bind just a specific button in the data template to the viewmodel of the parent listView.</p>

<p>How do I do that?</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ContentPage 
        xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
        x:Class="MobileMobile.Views.MobileMessageListView"
        Title="Message List"
        NavigationPage.BarBackgroundColor="#FF9100"
        NavigationPage.BarTextColor="White"
        xmlns:ViewSwitchers="clr-namespace:MobileMobile.ViewSwitchers;assembly=MobileMobile"
        xmlns:ViewCells="clr-namespace:MobileMobile.ViewCells;assembly=MobileMobile"
        xmlns:Extensions="clr-namespace:MobileMobile.Extensions;assembly=MobileMobile"
        &gt;

    &lt;ContentPage.Resources&gt;
        &lt;ResourceDictionary&gt;
            &lt;DataTemplate x:Key="botMessageDataTemplate"&gt;
                &lt;ViewCell&gt;
                    &lt;Button Text="Hello!" Command="{Binding TestCommand, Source=???}" CommandParameter="Hello"/&gt;
                &lt;/ViewCell&gt;
            &lt;/DataTemplate&gt;

            &lt;ViewSwitchers:MobileMessageTemplateSwitcher x:Key="MobileMessageTemplateSwitcher" BotMessageDataTemplate="{StaticResource botMessageDataTemplate}" /&gt;
        &lt;/ResourceDictionary&gt;
    &lt;/ContentPage.Resources&gt;

    &lt;ContentPage.Content&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="*" /&gt;
                &lt;RowDefinition Height="Auto" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="*" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;StackLayout Grid.Row="0" Orientation="Vertical" x:Name="MainViewStack"&gt;
                &lt;ListView
                        CachingStrategy="RecycleElement"
                        BackgroundColor="Transparent"
                        ItemTemplate="{StaticResource MobileMessageTemplateSwitcher}"
                        IsPullToRefreshEnabled="true"
                        RefreshCommand="{Binding RefreshCommand}"
                        ItemsSource="{Binding Messages}"
                        HasUnevenRows="true"
                        IsRefreshing="{Binding IsLoading, Mode=OneWay}"
                        SeparatorVisibility="None"&gt;
                    &lt;ListView.Footer/&gt;
                &lt;/ListView&gt;
            &lt;/StackLayout&gt;
            &lt;StackLayout Grid.Row="1" Orientation="Horizontal" HeightRequest="50"&gt;
                &lt;Entry Text="{Binding CurrentMessageText}" Placeholder="{Binding MessageTextPlaceHolder}" HorizontalOptions="FillAndExpand"/&gt;
                &lt;Button Text="SEND" Command="{Binding SendMessageCommand}"/&gt;
            &lt;/StackLayout&gt;
        &lt;/Grid&gt;
    &lt;/ContentPage.Content&gt;
&lt;/ContentPage&gt;
</code></pre>