TWebMainMenu IndexOf() syntax is OK in LSP but fails in compiler

I have a TWebMainMenu control WebMainMenu1 with a menu item Item1 and I'd like to modify its visibility with this:

WebMainMenu1.Items[WebMainMenu1.Items.IndexOf(Item1)].Visibile := <boolean>

The LSP is happy with this statement, but the compiler reports:

[Error] CWRmainForm.pas(1652): identifier not found "IndexOf"

Is this a compiler bug, or do I need a different syntax?