Guidance on filtered lists in Silverlight

Guidance on filtered lists in Silverlight

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


griff posted on Tuesday, October 16, 2012

I am looking  to filter a ReadOnlyListBase (or other csla object).  Originally I had a list-box binded to this rolb but now that I want to filter (via the UI)  I am right in thinking that I need to bind a LinqObservableCollection and then retrieve my rolb then convert to LinqObservableCollection

XAML   ItemsSource="{Binding Path=GridList, Mode=TwoWay}" 

MVVM:
        private void GetJobsGridSimpleListCompleted(object sender, Csla.DataPortalResult<JobsGridSimpleList> e)
        {
            if (e.Object != null && e.Error == null)
            {
                JobsGridSimpleList = e.Object;  // my ROLB
                GridList = (from r in _JobsGridSimpleList  select r).ToSyncList(_JobsGridSimpleList);
            }
            else
            {
                MessageBoxServiceProvider.ShowError(string.Format("There was an error (details below){0}{1}", System.Environment.NewLine, e.Error.Message), string.Format("Error: in {0} - {1}Completed ", VMName, "GetJobsGridSimpleList"));
            }
        }

Is this the best (or acceptable) way of achieving this using Csla.
Thanks,.


 

RockfordLhotka replied on Tuesday, October 16, 2012

Yes, you should use the ToSyncList extension method to create a syncronized list based on the ROLB. We created ToSyncList specifically for this purpose.

Copyright (c) Marimer LLC