IFACEMETHODIMP CTriColorControlProvider::Navigate(_In_ NavigateDirection direction, _Outptr_result_maybenull_ IRawElementProviderFragment ** retVal)
{
    *retVal = nullptr;
    ComPtr<IInspectable> spFragment;
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        if (direction == NavigateDirection_Parent)
        {
            hr = m_control->GetAppWindowProvider(&spFragment);
        }
        else if (direction == NavigateDirection_FirstChild)
        {
            hr = m_control->GetTriColorFragmentProvider(TriColorValue::Red, &spFragment);
        }
        else if (direction == NavigateDirection_LastChild)
        {
            hr = m_control->GetTriColorFragmentProvider(TriColorValue::Green, &spFragment);
        }
    }

    if (SUCCEEDED(hr) && spFragment != nullptr)
    {
        hr = spFragment.Get()->QueryInterface(IID_PPV_ARGS(retVal));
    }

    // For the other directions (next, previous) the default of nullptr is correct
    return hr;
}
IFACEMETHODIMP CTriColorFragmentProvider::get_FragmentRoot(_Outptr_result_maybenull_ IRawElementProviderFragmentRoot ** retVal)
{
    *retVal = nullptr;
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        ComPtr<IInspectable> spFragmentRoot;
        hr = m_control->GetAppWindowProvider(&spFragmentRoot);
        if (SUCCEEDED(hr))
        {
            hr = spFragmentRoot.Get()->QueryInterface(IID_PPV_ARGS(retVal));
        }
    }
    return hr;
}