如何在WPF中为3D对象提供工具提示(或标签)? [英] How to give a tooltip(or a tag) to a 3D object in WPF?
问题描述
我已经使用W#中的C#代码创建了四个3D多维数据集(类似于多维数据集),当它们出现在屏幕上时,我想向它们添加工具提示(或标签).当我将鼠标移到多维数据集上时,工具提示应显示"cube1"或"cube2"
这只是我编写的用C#创建多维数据集的方法的一部分.
meshgeometry =新的GeometryModel3D(mesh,diffmaterial);
ModelUIElement3D m =新的ModelUIElement3D();
m.Model =网格几何;
visual.Children.Add(m);
在构造函数中,此方法被调用了四次.我想解决(或访问)单个多维数据集并给它们添加标签?我怎样才能做到这一点 ?请帮助.我被困住了.我可以做一些类似于Children [0]."something"的操作来访问每个多维数据集吗?我是一个初学者,请放心.
I have created four 3D cubes(something that looks like cube) using C# as codebehind in WPF and I would like to add a tooltip (or a tag) to them when they appear on the screen. When I move my mouse over the cube, the tooltip should display "cube1" or "cube2"
this is just a part of a method i''ve written to create a cube in C#.
meshgeometry = new GeometryModel3D(mesh, diffmaterial);
ModelUIElement3D m = new ModelUIElement3D();
m.Model = meshgeometry;
visual.Children.Add(m);
This method is called four times with in the constructor. I would like to address (or access) individual cubes and give them a tag ? How can i do this ? please help.I am stuck. Can i do something like Children[0]."something" to access every cube ? I am a beginner and please go easy on me.
推荐答案
要为他们提供Tag属性,您可以使用 ^ ].
To give them a Tag property, you might be able to use an attached property[^].
这篇关于如何在WPF中为3D对象提供工具提示(或标签)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!