public override IRawElementProviderFragment Navigate (NavigateDirection direction)
{
if (direction == NavigateDirection.Parent) {
// TODO: Review this
// "Fragment roots do not enable navigation to
// a parent or siblings; navigation among fragment
// roots is handled by the default window providers."
// Source: http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.irawelementproviderfragment.navigate.aspx
// if (Provider is FragmentRootControlProvider)
// return Provider.FragmentRoot;
if (parentNavigation == null)
return Provider.FragmentRoot;
else
return parentNavigation.Provider;
}
else if (direction == NavigateDirection.FirstChild)
return chain.First == null ? null : chain.First.Value.Provider;
else if (direction == NavigateDirection.LastChild)
return chain.Last == null ? null : chain.Last.Value.Provider;
else if (direction == NavigateDirection.NextSibling && parentNavigation != null)
return parentNavigation.GetNextExplicitSiblingProvider (this);
else if (direction == NavigateDirection.PreviousSibling && parentNavigation != null)
return parentNavigation.GetPreviousExplicitSiblingProvider (this);
else
return null;
}