Inheriting from Screen breaks existing DataBinding

Nov 25, 2010 at 7:28 PM

Im currently porting my app to use Caliburn Micro.

The next step was to let my ViewModels inherit from Screen.

But after that, my DataBinding on a ObservableCollection stops. No errors, no nothing.

So in my ViewModel I have this piece of code:

 

 Workspaces = new ObservableCollection<TeamViewModel>();

Somewhere else in code, I say

Workspaces.Add(new TeamViewModel());


Workspaces now contains one ViewModel, but the TabControl's ItemSource that is bound to the Workspaces isnt updatet.
My TabControl looks like this:

<TabControl x:Name="TabControlTeams" 
                        ItemsSource="{Binding Workspaces}" 
                        SelectedIndex="{Binding Path=SelectedIndex}" />

When I remove the Screen inheritance, its working like a charm.

Whats can possibly go wrong here?

Coordinator
Nov 26, 2010 at 2:26 PM

Not sure. I use screens all the time and haven't had any issues like this. You'll need to send me a small, simple, repro in order for me to get to the bottom of that. Feel free to email it to: robertheisenberg at hotmail dot com

Nov 26, 2010 at 4:30 PM

I will, but have not mutch time right now.

But when I put ActiveItem(new TeamViewModel(Team)) in the constructor, it seems to work. 

When I add a new ViewModel to the collection during runtime it is added to the collection, but the UI (TabControl) is not updated.

Maybe this helps.

 

Ill try to make a small demo the comming days.

Nov 27, 2010 at 9:29 AM

I sended you a demo.

Hope it helps, thanks.

Cheers