private static FrameworkElement FindNavigatorElement(FrameworkElement elm, BlockNavigator self = null) { var searchElm = elm; while (true) { if (searchElm.Parent == null) { break; } if ((bool)searchElm.GetValue(BlockNavigator.NestedNavigationProperty) == true) { var nav = BlockNavigator.GetBlockNavigator(searchElm); if (self != null && nav != self) { searchElm = (FrameworkElement)searchElm.Parent; continue; } return(searchElm); } searchElm = (FrameworkElement)searchElm.Parent; } return(searchElm); }
private static void SetBlockNavigator(UIElement element, BlockNavigator value = null) { element.SetValue(BlockNavigatorProperty, value ?? new BlockNavigator(element)); }