我在 wpf 中做一些事情,其中填充了数据网格。我需要数据网格中的每一行,当我指向鼠标时,应该可以看到一个包含图像的工具提示。这个图像对于数据网格的每一行都是不同的。我该怎么做。我已经能够做到这一点:
Image img = new Image();
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.UriSource = new Uri(Directory.GetCurrentDirectory()+ "\\Kartik.JPG");
bmp.DecodePixelHeight=200;
bmp.DecodePixelWidth=200;
bmp.EndInit();
img.Source=bmp;
ToolTipService.SetPlacement(dgAssortment, System.Windows.Controls.Primitives.PlacementMode.Center);
ToolTipService.SetToolTip(dgAssortment, img);
ToolTipService.SetShowDuration(dgAssortment, 99999999);
但这为整个数据网格显示了相同的图像,无论我将鼠标指针放在哪一行。如何使该图像对于数据网格中填充的每一行都不同。请帮忙。提前致谢。