Solved

IEnumerable

Posted on 2008-06-21
9
188 Views
Last Modified: 2013-11-12
How do you use the  IEnumerable in silverlight as the MSDN example is confusing.
0
Comment
Question by:jagguy
  • 8
9 Comments
 
LVL 1

Accepted Solution

by:
jacek_j1978 earned 500 total points
ID: 21837720
Hi,
I suppose that you think about this example:
http://msdn.microsoft.com/en-us/library/system.collections.ienumerable(VS.95).aspx
Could you clarify what is not clear for you?
0
 

Author Comment

by:jagguy
ID: 21839275
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?
0
 

Author Comment

by:jagguy
ID: 21839283
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
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:jagguy
ID: 21839366
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
0
 

Author Comment

by:jagguy
ID: 21840020
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
0
 

Author Comment

by:jagguy
ID: 21840027
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
0
 

Author Comment

by:jagguy
ID: 21840357
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
0
 

Author Comment

by:jagguy
ID: 21840449
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
0
 

Author Comment

by:jagguy
ID: 21842525
anyone?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question