I think you need to clone cmslistmenu control and customize it (or use the condition below in your logic). In the code behind there is an event in cmslistmenu.acx.cs which sets visiblilty:
/// <summary>
/// OnPrerender override (Set visibility).
/// </summary>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Visible = menuElem.Visible;
if (DataHelper.DataSourceIsEmpty(menuElem.DataSource) && (menuElem.HideControlForZeroRows))
{
Visible = false;
}
}
Just add you subNavigationWrapper.Visible = false;
in there if youare customizing it or use the condition above in your code