Silverlight menu function error


code =
Enviroment: Silverlight 4 RC

Please look at the below code, I have highlighted lines with errors. Essentially this is a menu in a silverlight application , when I click over the menu it should open the menu with further submenus.Can you please advise how I can fix these errors?

 Private Sub getMenuItems(ByVal xml As XElement)
        Dim lstItems = From p In xml.Elements("Item") _  <----- I get error Error "Expression of type 'Object' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider."
        Select p
        For Each el In lstItems < ----- I get error " Expression is of type 'Object', which is not a collection type."      
            Dim Text As String = el.Attribute("Text").Value
            Dim Id As Integer
            Int32.TryParse(el.Attribute("Id").Value, Id)
            If el.HasElements = False Then
                lstMenuItems.Add(New MenuItem(Text, Id, 0, 0))
                lstMenuItems.Add(New MenuItem(Text, Id, 0, el.Elements("Item").Count()))
                Dim subItems = From pSub In el.Elements("Item") _
                    Select pSub
                For Each [sub] In subItems
                    Text = [sub].Attribute("Text").Value
                    Int32.TryParse([sub].Attribute("Id").Value, Id)
                    lstMenuItems.Add(New MenuItem(Text, Id, 1, 0))
            End If
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SeosaimhAuthor Commented:

Anybody able to help, I resolced the second error, just the first I need help with..

This is most likely because you are missing an assembly reference. To query System.Xml.Linq.XElement objects, you need to reference "System.Core".
SeosaimhAuthor Commented:
I have added the below and it still is appearing the error

"Expression of type 'Object' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider."

what else could be casuing it?
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

SeosaimhAuthor Commented:
this was added sorry:
Option Infer On
Option Strict Off
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Xml.Linq
Imports System.Core
You don't need to (or can) include an "Imports" statement. You need to reference the assembly. If you are using Visual Studio or SharpDevelop, you should be able to do this by right-clicking on the project in the Solution pane.
SeosaimhAuthor Commented:
Just added the reference to the project, and when I hit ctrl f5 the error is still appearing. What else can I do?
Is there any chance that you could share the relevant project? If not, could you share the single file?
SeosaimhAuthor Commented:
have a look at the attached. the menu is developed in expression blend , as such has xaml behind it,  but no need for this to be atatched I think.
Your problem is that you have declared your own class called "XElement". Please delete the class declaration for "XElement" and make sure you are referencing the System.Xml.Linq assembly.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SeosaimhAuthor Commented:
Do you  see  That is referenced about eight times, but in each one I am getting the following error:

"Option strict on disallows late binding."   -  how do I fix this? I can switch it off, but I understand this causes problems at run time..
SeosaimhAuthor Commented:
Hi, any help please?
SeosaimhAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.