我已通过以下方式在dataGrid上定义了工具提示:
<DataGridTextColumn.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="ToolTip" > <Setter.Value> <ListBox ItemsSource="{Binding Value.TimeStamps}"></ListBox> </Setter.Value> </Setter> </Style> </DataGridTextColumn.CellStyle>
但是工具提示闪烁,并且很难阅读内容。 如何解决这个问题?
****编辑: 绑定是一个ObservableDictionary,键和值都是ViewModel
该值具有以下属性
> #region timeStamps
> /// <summary>
> /// The <see cref="TimeStamps" /> property's name.
> /// </summary>
> public const string TimeStampsPropertyName = "TimeStamps";
>
> private ObservableCollection<String> _timeStamps = new ObservableCollection<string>();
>
> /// <summary>
> /// Sets and gets the TimeStamps property.
> /// Changes to that property's value raise the PropertyChanged event.
> /// </summary>
> public ObservableCollection<String> TimeStamps
> {
> get
> {
> return _timeStamps;
> }
> set
> {
> Set(TimeStampsPropertyName, ref _timeStamps, value);
> }
> }
> #endregion
这是应在工具提示中显示的属性。