0

I'm developing my first WPF application that queries a database and shows some records of some tables in TabControl if one or more fields of these records not satisfy certain condition.

I have a DataTable as data source and I use a DataGrid to show results (i.e. the wrong records). I'd like to use ToolTip on DataGridCell to indicate why a field is considered wrong. There's a way to iterate over the DataGridRow and the DataGridCell so that I can set dynamic ToolTipfor every specific field?

Thanks in advance.

1 Answers1

0

I would bind the DataGrid selected item to a SelectedRecord property in my view model (where the data source is coming from), see Get selected row item in DataGrid WPF as an example. The SelectedRecord property would then set the SelectedRecordToolTip property in accordance to the SelectedRecord value (i.e. using a dictionary with the error as the key and the tooltip as the value). Finally, you can then bind your tooltip to the SelectedRecordToolTip property.

Community
  • 1
  • 1
Ahmad
  • 1,462
  • 15
  • 23