BindablCollection and Async Framework

Jun 3, 2011 at 9:27 AM
Edited Jun 3, 2011 at 10:28 AM

I'm working with both of them in my project. I run into following issue - it seems that for example AddRange which is invoked on UI thread is breaking something.

 

		public BindableCollection<Test> Tests {
			getset;
		}
		private async void GetData() {
			var count= 0;
			while( count < 100 ) {
				var tests = await GetTests();
                                this.Tests.AddRange( tests );
				count+= tests.Count();
			}
		}

I think that AddRange force everything after it to run on UI thread (UI is not responding). When using ObservableCollection and adding returned tests elements one by one UI is responding normally.