更新时间:2022-12-16 11:20:41
谢谢你们所有的努力。我发现下面的解决方案。
我们必须使用control.GetValue(Control.NameProperty)
例如,在下面的代码中,通过跟踪mainWindow即MovieWindow,我将获得Button。
要获取Button的名称,我应该这样做
Thanks guys for all your effort. I found out below solution.
We have to use control.GetValue(Control.NameProperty)
For Example, In the below code, by tracing mainWindow i.e MovieWindow, I will get Button.
To get the name of the Button, I should do
myKid.GetValue(Control.NameProperty)
这是通过使用dependecy属性GetValue method()。
(DependencyObject.GetValue(Control.nameProerty))
This is by using dependecy property GetValue method().
(DependencyObject.GetValue(Control.nameProerty))
dim myKid as DependencyObject = Nothing
for i as integer =0 to VisualTreeHelper.GetChildrenCount(MovieWindow) -1
myKid = VisualTreeHelper.GetChild(MovieWindow,i)
dim controlName as string = myKid.DependecyObjectType.Name
Next
***的问候,
Vijay
Best Regards,
Vijay