3
votes

I'm working on a WPF project that is using Caliburn Micro. I am running into a problem where the controls in the View are not getting updated the second time the View is opened. The first time the data binding works fine.

When I step through the ViewModel the second time the View is invoked I can see that the data bound properties are getting new values and invoking NotifyOfPropertyChange() but the change is not reflected in the UI. Any ideas? My View inherits PropertyChangedBase()

Below are my properties in view model

public string Info
{
    get { return _info; }
    set { _info = value; NotifyOfPropertyChange(() => Info); }
}

public IEnumerable<ComponentInfo> BondableComponents
{
    get { return _bondableComponents; }
    set { _bondableComponents = value; NotifyOfPropertyChange(() => BondableComponents); }
}

and Xaml

<TextBox Name="Info" Grid.Row="0" Grid.Column="0" IsReadOnly="True"/>
<DataGrid ItemsSource="{Binding BondableComponents}">
1
Can you show the code which is opening and closing your View? - nemesv
Are you populating data in OnInitialize instead of OnActivate or OnViewLoaded? - Derek Beattie

1 Answers

-1
votes
BindableCollection<ComponentInfo> Bondable

Should be used if you new items to appear on an update... --edit-- answered on GitHub.