FrameworkElement.Parent and VisualtreeHelper.GetParent behaves differently

后端 未结 2 1655
迷失自我
迷失自我 2021-01-19 05:19

In a WP7 app, I used FrameworkElement.Parent recursively to determine whether a specific element is inside of another element. But it does not always work correctly. Then I

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 05:58

    "The value reported by the FrameworkElement.Parent property in Silverlight is generally the same value that would be reported by using VisualTreeHelper API, because the two tree concepts are frequently synchronized as far as how parent-child relationships are reported. However, there may be cases where FrameworkElement.Parent reports a parent that VisualTreeHelper does not."

    http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.parent(v=VS.95).aspx

提交回复
热议问题