I have a DataGrid with three columns.
There is a delete button in the third column. Its visibility depends on boolean property called 'ControlsEnabled'.
DataGrid is populated by items in 'ObservableCollection'.
The problem is that 'ControlsEnabled' is not a property of items in our 'ObservableCollection' and it should not be. 'ObservableCollection' is property of another class.
Question: how should I change my XAML description to solve my problem?
<DataGrid.Columns>
    <DataGridTextColumn Binding="{Binding Path=field1}" 
                        Width="140" 
                        Header="head1"/>
    <DataGridTextColumn Binding="{Binding Path=field2}" 
                        Width="140" 
                        MinWidth="50" 
                        Header="head2"/>
    <DataGridTemplateColumn>
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <Button Padding="5" 
                        Click="DeleteButton_Click" 
                        Tag="{Binding}" 
                        Content="X" 
                        Visibility="{Binding Path=ControlsEnabled, Converter={StaticResource boolToVisibilityConverter}}">
                    <Button.ToolTip>
                        <TextBlock>
                            Delete
                        </TextBlock>
                    </Button.ToolTip>
                </Button>
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
</DataGrid.Columns>
Thank you!
 
     
     
     
    