Wpf 列表框中的自我工具提示

Wpf 列表框中的自我工具提示,wpf,mvvm,binding,listbox,Wpf,Mvvm,Binding,Listbox,我有一个listox,它绑定到某个可观察集合,我希望每一行的工具提示都是行内容 我试过像: <ListBox ItemsSource="{Binding MyList}"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="ToolTip" Value="{Binding MyList}"/&

我有一个listox,它绑定到某个
可观察集合
,我希望每一行的工具提示都是行内容

我试过像:

<ListBox  ItemsSource="{Binding MyList}">
    <ListBox.ItemContainerStyle>
         <Style TargetType="ListBoxItem">
             <Setter Property="ToolTip" Value="{Binding MyList}"/>
          </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

在ViewModel中:

public ObservableCollection<string> _myList;
    public ObservableCollection<string> MyList
    {
        get { return _myList; }
        set
        {
            if (value != this._myList)
                _myList = value;
            RaisePropertyChanged("MyList");
        }
    }
publiccobservecollection\u myList;
公共可观测集合MyList
{
获取{return\u myList;}
设置
{
如果(值!=此.\u我的列表)
_myList=值;
RaisePropertyChanged(“MyList”);
}
}

但是它没有显示工具提示ListBoxItem的DataContext是MyList中的一个元素

<ListBox  ItemsSource="{Binding MyList}">
    <ListBox.ItemContainerStyle>
         <Style TargetType="ListBoxItem">
             <Setter Property="ToolTip" Value="{Binding}"/>
          </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

ListBoxItem的DataContext是MyList中的一个元素

<ListBox  ItemsSource="{Binding MyList}">
    <ListBox.ItemContainerStyle>
         <Style TargetType="ListBoxItem">
             <Setter Property="ToolTip" Value="{Binding}"/>
          </Style>
    </ListBox.ItemContainerStyle>
</ListBox>