I’m still trying to figure out what is going on with my code, but I have a class that has notify directive used on some properties. Then I have a couple of descendent classes that have their own notify properties. The problem I’m having is, even though the ancestor property changed and has values, the descendent class that is bound to a UI DataGrid in WPF, is not showing the values.
If I specifically call PropertyChanged, then the DataGrid shows the data. So there is a binding and it is listening for changes, but changing the value isn’t triggering the UI update.
One thought I have is that the property is being changed in a backgroundworker thread. The oddest thing is that it seems to work okay with one of the descendents and not the other.
Is there something else I should be doing that is obvious that I’m missing?
And if I put a propertychanged listener on the ancestor class and the descendent, I see the ancestor triggering the event, but I don’t see the descendent being triggered.
Summarizing, my UI is bound to the descendent class and inherits a property with the notify directive, but the descendent class never sees the property changed of the ancestor property.
Hope that all makes sense. At the moment, I don’t have a simple example to upload.
Can you give some more info on which classes fail and which don’t?
Looking at SourceViewmodel : SchemaViewmodel, decompiled initialiseBaseScriptCommand looks like:
public InitializeBaseScriptCommand InitializeBaseScriptCommand
{
get
{
return this.@p_InitializeBaseScriptCommand;
}
set
{
if (this.@p_InitializeBaseScriptCommand == value)
{
return;
}
base.raise_PropertyChanging(this, new PropertyChangingEventArgs("InitializeBaseScriptCommand"));
this.@p_InitializeBaseScriptCommand = value;
base.raise_PropertyChanged(this, new PropertyChangedEventArgs("InitializeBaseScriptCommand"));
}
}
SourceViewmodel seems to have property notification working and the SourceView.xaml VSDSSchema.Tables gets refreshed automatically apparently due to the notification.
TargetViewmodel makes the same sort of calls, but unless I do my own call to PropertyChanged, the VSDSScheme.Tables in TargetDatabaseView.xaml does not resolve the binding.
It is the MigrateData method that isn’t resolving.
Hopefully, I’m missing something that isn’t obvious (because it isn’t to me )
Is this fixed in a release I can download? I’m hoping it is causing me some random problems I’m having to work quite a bit to work around and in one case, I haven’t figured a work around yet.
… time passes …
I’m trying out the latest gamma.
… time passes …
Unfortunately, that gamma still doesn’t solve my problem. I have a Datagrid with a binding to an ObservableCollection of objects and as the objects are added, the UI is not updated. And even when the whole collection is populated, it still doesn’t show the data in the list. I’ll have to keep plugging away and see if I can figure out what the problem is. I was hoping it was the property changed event not being triggered properly, but if the RemObjects Elements - 8.4.96.2057.exe version was supposed to include the bug fix, then my problem is not that.
Will keep you informed if I figure out more.
… time passes …
Well, to make matters more confusing, in my original post, the SourceViewmodel was refreshing properly and the TargetViewmodel was not. NOW, the SourceViewmodel that is bound to the datagrid isn’t refreshing its content any more. I don’t know when it started failing nor what caused it to fail. Still looking into it.
… time passes …
In the backgroundworker thread completed event, I had to add:
method SourceViewmodel.GetTablesCompleted(sender: Object; e: RunWorkerCompletedEventArgs);
begin
inherited GetTablesCompleted( sender, e );
// had to add this or the inherited notify was not triggered
if assigned( PropertyChanged )
then PropertyChanged( self, new PropertyChangedEventArgs( 'VSDSSchema' ) );
In order to get the VSDSSchema bound items to refresh.
I’m wondering if the problem is that the code to get the data for the Viewmodel is running as a background thread.