I'm struggling with relative Sources. I'm inside Tab Items and I want to reach the parent ModelView. The goal is to make some context menu items invisble, if the item is the last tab.
ViewModel:
public bool IsLastTab => ItemCollection.Count > 1;
xaml:
<Window x:Name="MainWinodw"
    ...
    xmlns:ct="clr-namespace:ChromeTabs;assembly=ChromeTabs"
    xmlns:vm="clr-namespace:Main.ViewModel"
    xmlns:conv="clr-namespace:Main.Converters"
    xmlns:ctConv="clr-namespace:ChromeTabs.Converters;assembly=ChromeTabs"
    xmlns:usercontrols="clr-namespace:Main.UserControls"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    ...
    DataContext="{Binding Source={StaticResource Locator},Path=Main}" ">
<Window.Resources>
    <conv:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
    ...
</Window.Resources >
<Grid>
    <ct:ChromeTabControl x:Name="MyChromeTabControl"
                         TabPersistBehavior="Timed"
                         TabPersistDuration="0:0:0:5"
                         AddTabButtonBehavior="OpenNewTab"
                         Background="AliceBlue"
                         ItemsSource="{Binding ItemCollection}"
                          ...">
        ...
        <ct:ChromeTabControl.ItemTemplate>
            <DataTemplate>
                <Grid Tag="{Binding RelativeSource={RelativeSource AncestorType={x:Type ct:ChromeTabItem}}}">
                    ...
                    <Grid.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Close"
                                      Command="{Binding Path=PlacementTarget.Tag.CloseTabCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                      Visibility="{Binding IsLastTab,  
                                                    RelativeSource={RelativeSource AncestorType={x:Type vm:ViewModelChromeTabs}}, 
                                                    Mode=OneWay, 
                                                    Converter={StaticResource InverseBooleanToVisibilityConverter}}"
                                      CommandTarget="{Binding Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                            ...
                            <Separator />
                            <MenuItem Header="{Binding IsPinned, Converter={StaticResource BooleanToPinTabTextConverter}}"
                                      Command="{Binding Path=PlacementTarget.Tag.PinTabCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                                      CommandTarget="{Binding Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      CommandParameter="{Binding}" />
                        </ContextMenu>
                    </Grid.ContextMenu>
                </Grid>
            </DataTemplate>
        </ct:ChromeTabControl.ItemTemplate>
    </ct:ChromeTabControl>
</Grid>
</Window>
It's working when I put it in the Item Class but there I have no Info about how many Tabs are left, and it seems counter logic to implement a messenger here for this.
 
     
    