Scroll to individual entry in a group by attributes, not index

JesseLibertyJesseLiberty USInsider, University ✭✭✭

I know how to scroll to an individual entry in a group using indices,

   public void GoToItemInGroup ( object obj, EventArgs e ) {
    var theGroup = EmployeesGrouped.ElementAt( 2 ); 
    var theItem = theGroup.ElementAt( 4 );
    EmployeeListView.ScrollTo( theItem, theGroup, ScrollToPosition.Start, true );
}

and I figured out how to go to an individual as long as I know the offset of the group,

   public void GoToSpecificItem ( object obj, EventArgs e ) {
    var theGroup = EmployeesGrouped.ElementAt( 3 );
    var employee = from x in theGroup
                         where x.FullName == "Lino Tadros"
                         select x;
    int offset = theGroup.IndexOf( employee.First( ) );
    var theItem = theGroup.ElementAt( offset );
    EmployeeListView.ScrollTo( theItem, theGroup, ScrollToPosition.Start, true );   
   }

But how would I write this if I didn't know the offset of the group, but rather wanted to figure it out by using the FullName's first letter?

I'm not sure how to create the query: which collection to I query against, and how do I turn the result into an Employee object?

Thanks

-jesse liberty

Sign In or Register to comment.