Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

IEnumerable

How do you use the  IEnumerable in silverlight as the MSDN example is confusing.
ASKER CERTIFIED SOLUTION
Avatar of jacek_j1978
jacek_j1978
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jagguy

ASKER

i am using hittest and it returns this data type which I dont know how to use it, is it like an array or collection?
Avatar of jagguy

ASKER

I cant understand properly as it is too big.
What do they mean by interface?
what is IEnumerator doing?

can i have a smaller example?
http://msdn.microsoft.com/en-us/library/system.collections.ienumerable(VS.95).aspx
Avatar of jagguy

ASKER

In mouseup this didnt work but i didnt get an error

  Dim u = From element In lb.HitTest(e.GetPosition(Nothing)) _
        Where element Is txt1 Select element

        If u.Count() > 0 Then
            txt1.Text = "hit"
        Else
            txt1.Text = "miss"
        End If
Avatar of jagguy

ASKER

All I am doing is dragging a textbox and when i drag the textbox onto any part of the listbox then I want to get a hit message displayed.

 

Looking at other codes we are getting the position of 'nothing'  from the canvas so I cant see how this makes sense. I translated c# into vb.net.

 
   Dim u = From element In Me.HitTest(e.GetPosition(Nothing)) _
         Where element.GetValue(NameProperty).ToString = "txt1" _
        Or element.GetValue(NameProperty).ToString = "lb" Select element




        txt1.Text = u.Count
Avatar of jagguy

ASKER

this doesnt work either as i get 0 always

      Dim u = From element In Me.HitTest(e.GetPosition(Nothing)) _
         Where element.GetValue(NameProperty).ToString Is "txt1" _
        Or element.GetValue(NameProperty).ToString Is "lb" Select element




        txt1.Text = u.Count
Avatar of jagguy

ASKER

if i do this i will get a hit if i drag the textbox over the listbox BUT the textbox is not one of the items that appears in the  result VAR from the for each.

let us forget about LINQ please for now.



     Dim result = lb.HitTest(e.GetPosition(Nothing))

        Dim ui As UIElement

        For Each ui In result

            ' If (ui Is txt1) Then
            txt1.Text = txt1.Text & " " & ui.ToString  'textbox does not appear but the hitest will detect a hit  with other UI objects
            '  End If
        Next
Avatar of jagguy

ASKER

this will only work if the mouse pointer in the textbox is also in the listbox so i need amore accurate way to get anypart over the listbox.

     Dim result = lb.HitTest(e.GetPosition(Nothing))

        Dim ui As UIElement

        For Each ui In result

            ' If (ui Is txt1) Then
            txt1.Text = txt1.Text & " " & ui.ToString  'textbox does not appear but the hitest will detect a hit  with other UI objects
            '  End If
        Next
Avatar of jagguy

ASKER

anyone?