I'm using the MVVM design pattern, and the DataContext
of my View is set to a ViewModel.
In my View, I have a ListView/GridView
with ItemsSource
bound to a DataTable
. One of the GridViewColumns
has a CellTemplate
that presents a Button
. I want the IsEnabled
property of the button to be bound to the SelectButtonsEnabled
property of my ViewModel.
Using IsEnabled="{Binding Path=SelectButtonsEnabled}"
doesn't work because my DataTable
doesn't have a column named "SelectButtonsEnabled". The property I'm trying to bind to is global for the whole ViewModel, not specific to a row of the DataTable
.
I think I need some kind of RelativeSource
tag, but all my attempts thus far have failed.
Thanks.