I've got a datatemplate for a tabcontrol's itemtemplate as follows;
<DataTemplate x:Key="TabItemTemplate">
<DockPanel Width="120">
<Button
Command="{Binding Path=DataContext.DeleteTimeTableCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Content="X"
Cursor="Hand"
DockPanel.Dock="Right"
Focusable="False"
Margin="0,1,0,0"
Padding="0"
VerticalContentAlignment="Bottom"
Width="16" Height="16" />
This is OK as it gives me a button in the tabcontrol to allow for deleting the current tabitem.
Trouble I'm having is that the Delete command I'm binding to has a canExecute method which updates all buttons across all of the tabs in the tabcontrol. I just want the current tab to be affected.
I've got property CanDelete which I want to include in my Command. I'm trying to find a good example on CommandParameters as I think this is the way I need to go.
Has anyone got a good suggestion for the best way to do this?
Thanks.