I\'ve got a ListBox that displays an ObservableCollection of Talent objects. When the user hovers over each item in the ListBox, I\'d like to display in the ToolTip several piec
After a quick test your code seems to work fine.
My test:
xaml:
Code:
public partial class MainWindow : Window
{
private ObservableCollection _models = new ObservableCollection();
public MainWindow()
{
InitializeComponent();
Models.Add(new MyModel { tName = "Test", Description = "Hello" });
}
public ObservableCollection Models
{
get { return _models; }
set { _models = value; }
}
}
public class MyModel : INotifyPropertyChanged
{
private string _tName;
private string _description;
public string tName
{
get { return _tName; }
set { _tName = value; NotifyPropertyChanged("tName"); }
}
public string Description
{
get { return _description; }
set { _description = value; NotifyPropertyChanged("Description"); }
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
result:
