FrameworkElement __do = this.Parent as FrameworkElement; while (__do != null) { __do = __do.Parent as FrameworkElement; if (__do.Parent == null) break; } (__do as Scheduling).GetDetail();