So I have this TabControl:
<Window
x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1.ViewModel"
mc:Ignorable="d"
Title="Notepad-- - Octavian Niculescu" Height="450" Width="800">
<Window.DataContext>
<local:MainWindowViewModel/>
</Window.DataContext>
<!-- ... -->
<TabControl SelectedIndex="{Binding SelectedTab}" ItemsSource="{Binding FileTabs}">
<TabControl.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding FileName}"/>
<Button
BorderBrush="Transparent"
Background="Transparent"
Command=""
>X</Button>
</DockPanel>
</DataTemplate>
</TabControl.ItemTemplate>
and FileTabs is of this type
public ObservableCollection<FileTabModel> FileTabs { get; set; }
Because I've used FileTabs as an ItemsSource, everything that I'm trying to bind inside this TabControl leads to FileTabModel fields.
In the Button, on the Command attribute, I don't want that. I want to bind to a function from my namespace (local:MainWindowViewModel), where I got FileTabs from.
Is there any way to do this?
If so, how?