close



            FrameworkElement page = null;
            FrameworkElement temp = this;

            do {
                temp = VisualTreeHelper.GetParent(temp) as FrameworkElement;

                if (temp is Page) {

                    page = temp;
                    break;
                }

            } while (temp != null);



參考資料:

https://social.msdn.microsoft.com/forums/silverlight/en-US/2f688b26-026a-438e-a227-c322e577b10f/how-to-get-parent-of-a-customised-control

arrow
arrow
    全站熱搜

    小賢 發表在 痞客邦 留言(0) 人氣()