Parameterized Dynamic Root List

Parameterized Dynamic Root List

Old forum URL: forums.lhotka.net/forums/t/7912.aspx


lhicks posted on Friday, October 30, 2009

A Dynamic Root List contains a collection of Editable Root concerts.

In a Silverlight app, I would like the user to be able to select a month from a list, then display a filtered list of concerts for that month.

I have been unable to figure out how to pass a parameter to retrieve a filtered Dynamic Root List.

Gotta be easy, but I'm stymied.

Ideas?

RockfordLhotka replied on Friday, October 30, 2009

It works the same as with any list. You create a factory that accepts the parameter, pass the value through the data portal in a criteria object and use the value in the fetch method.

public static MyList GetList(int month, ... callback)
{
  var dp = new DataPortal<MyList>();
  dp.FetchCompleted += callback;
  dp.BeginFetch(new SingleCriteria<MyList, int>(month));
}

#if !SILVERLIGHT
  private void DataPortal_Fetch(SingleCriteria<MyList, int> criteria)
  {
    // retrieve filtered list here
  }
#endif

 

Copyright (c) Marimer LLC