Loading a collection in resources to use as a ConverterParameter

Loading a collection in resources to use as a ConverterParameter

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


gautamh posted on Friday, October 28, 2011

Normal 0 false false false EN-GB X-NONE X-NONE MicrosoftInternetExplorer4

Hi,

I'm strugging with this issue and would appreciate any help.

My issues is that  I need to load a collection to use it as a ConverterParameter. I have this in my view.

<UserControl.Resources>

        <localviewmodels:DealsViewModel x:Key="mdeals" />

</UserControl.Resources>

where DealsViewModel is the collection I need to load. Now this will be done asynchronously.

My problem is that the constructor of the of the DealsViewModel gets called as soon the InitializeComponent() on the containing view is called.

How do I prevent the view from displaying untill the DealsViewModel collection has completed loading? 

I suspect this could be an issue for scenarios where you have an edit item template that contains a ComboBox that needs to be loaded with a collection.

Is this the correct approach or has anyone used any other approach?

Any help will be hugely appreciated.

Regards,

Gautam

paul_rockerdale replied on Friday, October 28, 2011

How about using a busy control to block out the UI whilst the Deals are loading... If you using csla.xaml you can bind the IsBusy property... I use the WPFToolKit's Busy Control.

 

 

 

 

<extToolkit:BusyIndicator IsBusy="{Binding Path=IsBusy}" BusyContent="Please Wait..." >

 

 

 

 

</extToolkit:BusyIndicator>

gautamh replied on Friday, October 28, 2011

Thanks Paul.

I will use the IsBusy property to provide some indication that stuff is loading in the background.

However, after some (a lot) digging around, I realised my problem is that of loading look up lists for the view to populate some dropdowns, lookup etc and this is done by using the Unit of work pattern.

This thread illustrates this.

http://forums.lhotka.net/forums/p/10293/48257.aspx#48257

 

 

Normal 0 false false false EN-GB X-NONE X-NONE MicrosoftInternetExplorer4

Copyright (c) Marimer LLC