When creating a custom column design for a Silverlight DataGrid, is there any way to bind or make use of the DataGrid's SelectedItem property?
I wish to display a static element, but have it only visible for the row that is selected.
A simple example of what I'm after:
<data:DataGrid>
<data:DataGrid.Columns>
...
<data:DataGridTemplateColumn>
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="Selected" Visibility="{IsSelected ? Visible : Collapsed}">
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
...
</data:DataGrid.Columns>
</data:DataGrid>
- The column does not need to contain any other elements or bindings.
- It does not need to control the Visibility property specifically - any means that hides the element on all rows except the selected row will do.
Can this be done with styles? (Note that there is already one style applied to the DataGrid).