PropertyChanged in hierarchy not updating UI

Posts   
 
    
Puser
User
Posts: 228
Joined: 20-Sep-2012
# Posted on: 20-Sep-2012 16:03:32   

Hello,

We use LLBLGen Pro v3.5 final with the adapter templates on .net4.

I'm quite inexperienced in setting up bindings and hierarchies, but bear with me. I might be somewhat verbose.

I have a WPF MVVM calculation project where we use the following classes (narrowed down): - CalculatieView - CalculatieViewModel which exposes: - public EntityView2<ComponentGroepEntity> ComponentGroepenZichtbaar

This ComponentGroepEntity is extended as:

public partial class ComponentGroepEntity
{
    public EntityView2<ComponentEntity> ComponentView { get; set; }
    public bool Visible { get; set; }
}

In there you see a ComponentEntity and that one is also extended as:

public partial class ComponentEntity
{
    public CalcComponentEntity Component { get; set; }
}

In that CalcComponentEntity there are two major properties: - Waarde - Vastgezet

btw, You might notice that this is some kind of reversed setup of the following tables: calc - calccomponent - component - componentgroep. I have done that for now to have all components and to get visibility / hiding functionality.

I have setup a view with some DevExpress components which shows all information from ComponentGroepEntities to ComponentEntities to CalcComponentEntity (last two are shown as one row).

When Waarde in a CalcComponentEntity is changed, a 'calculation engine' is fired on the ViewModel which can change other CalcComponentEntities's Waarde (not all). But, these values are not reflected in the View. When I set focus on one of the changed Waarde controls, then it get's updated. It looks like the Binding does not get notified by the property change of Waarde. If have narrowed it down to where it works. The UI still get's updated when I programmatically change a property in ComponentEntity. But when changing one down in the convined CalcComponentEntity the notification is lost. In one variant I have tried listening to _component_PropertyChanged and send that to this.OnPropertyChanged("Component") and some other variants, but I am doing something wrong.

Has anyone some ideas?

Thanks in advance. Niels

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 20-Sep-2012 19:05:25   

Which LLBLGen Pro runtime library version are you using (check forum guidelines)?

Could you attach repro example, preferably on Northwind.

Puser
User
Posts: 228
Joined: 20-Sep-2012
# Posted on: 20-Sep-2012 21:06:52   

Sorry, Walaa, the version is 3.5.12.0614

I don't have a repro, i'm already 'very happy' that i could create this app over the last few weeks.

I wonder if what I want, could be done this way, but i don't think llblgen is broken though.

Puser
User
Posts: 228
Joined: 20-Sep-2012
# Posted on: 20-Sep-2012 23:36:56   

I don't know if it has something to do with it, but i must emphasize that at the end my row of data comes from 2 entities (ComponentEntity and CalcComponentEntity. the latter is encapsulated by ComponentEntity). Maybe the binding mechanism does not expect that? I'm a beginner in this field.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Sep-2012 06:29:15   

I don't see why changing something in ComponentEntity is different from changing something in ComponentEntity.Component. You said that programmatic changing properties on ComponentEntity fields triggers the control's update. Does that works the same if you change "programmatic" something at ComponentEntity.Component? or Dos it only occurs when you change it at UI?

You also said that you tried to subscribe to PropertyChanged. How does it looks like and Why you said that you must be doing something wrong?

Please show us some code to understand better your situation. Or better, cook some tiny repro case we can run over here to help you better. That should include your LLBLGen Pro file, a DDL script and some VS.Net code, all zipped, without dlls/bins/etc, just code/project files.

David Elizondo | LLBLGen Support Team
Puser
User
Posts: 228
Joined: 20-Sep-2012
# Posted on: 21-Sep-2012 12:14:35   

Fixed it.

It had nothing todo with LLBLGen Pro! The binding notifications work perfectly.

It had something to do with the DevExpress v12.1 GridColumn of the GridControl. You can simply use the property 'FieldName' and fill in 'Label' and 'Component.Waarde' and then you can see the values and change the 'Waarde' (and then the underlying value of Component.Waarde is updated accordingly) like so

<dxg:GridColumn FieldName="Component.Waarde" Width="60">

But, when you change Component.Waarde directly, then this is not picked up in the specific cell of the GridColumn. I found this message on DevExpress that pointed me in the right direction: http://www.devexpress.com/Support/Center/p/B205152.aspx

I can also use

<dxg:GridColumn DisplayMemberBinding="{Binding Path=Component.Waarde, Mode=TwoWay}" Width="60">

and then it works. I don't know why.

Thanks for your efforts Walaa and Daelmo (I really tried to create a repro but after spending some hours on SQL server and trying to get Northwind up and figuring out how it's all related, I searched further and found the solution).

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 21-Sep-2012 13:36:33   

Thanks for the feedback. Glad you found it.