Silverlight 4: Binding to IEnumerable

Aug 7, 2011 at 3:28 PM

Hi

I tried to set-up Obtics in my SL4 project to display live projections from an ObservableCollection in a ListBox. Reading through the wiki-pages I set it up and got it to compile, however I can't get the UI to update. When I break and look at the output of the projection though, all values are there...

Searching around for a solution, I found the POC-Project from another post, which runs perfectly. I then extended this to give me a list of values as an IEnumerable<> and bound them to a ListBox, which also works.

But as soon as I switch to SL4 and update Obtics and its dependenies to the newest trunk version, the IEnumerable<>-binding has the same problem as my large project: no UI-updates anymore. Getting a single value per the original demo app still works though.

Could anyone give me a solution/pointers/anything really?

Thank you,
Michael

Code I used in the Demo-Project: 

public IEnumerable<string> Strings
{
	get
	{
		return ExpressionObserver.Execute(_Integers, c => c.Select(v => "value: " + v.ToString())).Cascade();
	}
}

Coordinator
Aug 8, 2011 at 4:57 PM

Hi,

It seems like Silverlight first gets the sequence and only after registers for changes. Obtics in that case would not send any change notifications because it assumes the client doesn't know tha actual situation anyway (it having missed all change notifications in between getting the collection en registering for changes. This is real in mutithreaded situations but atmittedly hypothetical in singlethreaded situations).

Now when a client registers for changes the value or enumerator will always be probed so that Obtics will always send at least one change notification after every new registration. (and assuming the client responds to these change notifications will continue to send them)

Try the latest check-in.

Regs,

Thomas.

Aug 8, 2011 at 6:07 PM

Hi Thomas

Thanks so much for the quick help and fix. As far as I can tell it works perfectly now :)

Michael