Hi Greg,

 

Because you're binding to an object in a collection, the collection
needs to fire the property changed for the object.

 

Is your collection based on ObservableCollection?  That might raise the
property changed on your object for you, but sometimes you have to go
the extra mile and surface child changes as a change to the child
yourself (capture property changes on the relevant child properties in
your collection and raise the change for the child object).

 

Carl.

 

Carl Scarlett

Senior .NET/WPF Developer, UX Designer | Genesis

Enterprise Services | Bankwest

A: Level 5, 199 Hay Street | Perth | Western Australia | 6004

P: (08) 9449 8989

M: 0408 913 870

E: [email protected]

 

Description: test

 

 

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Greg Keogh <[email protected]>
Sent: Monday, 20 February 2012 6:41 AM
To: "'ozWPF'" <[email protected]>
Subject: Binding to parent object

 

Folk, my data grid columns used to bind to different properties of
objects in an observable collection, so I used to have something typical
like this:

 

<TextBlock Text="{Binding Name,Converter={...}}" ... />

<TextBlock Text="{Binding Phone,Converter={...}}" ... />

 

If any of the property values changed then the binding would update as
usual and things like colours and images would respond as my converter
was called. To get fancier converter logic I changed the binding to go
to the object, not the properties of the objects, like this:

 

<TextBlock Text="{Binding Converter={...},ConverterParameter='Name'}"
... />

<TextBlock Text="{Binding Converter={...},ConverterParameter='Phone'}"
... />

 

I adjusted the converter accordingly to cast the object and get the
properties. I've outsmarted myself as now the binding don't update when
the properties change, I presume because I no longer name the property
names.

 

Is there a way of binding to the object like my second example but still
get the bindings to update when properties change?

 

Greg


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

_______________________________________________ 
ozwpf mailing list 
[email protected] 
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf 

________________________________________________________________________
_______ 

This email has been scanned by the Bankwest Email Security System. 
________________________________________________________________________
_______ 

_______________________________________________________________________________
Unencrypted electronic mail is not secure and may not be authentic.
If you have any doubts as to the contents please telephone to confirm.

This electronic transmission including any attachments is intended only
for those to whom it is addressed. It may contain copyright material or
information that is confidential, privileged or exempt from disclosure by law.
Any claim to privilege is not waived or lost by reason of mistaken transmission
of this information. If you are not the intended recipient you must not
distribute or copy this transmission and should please notify the sender.
Your costs for doing this will be reimbursed by the sender.

We do not accept liability in connection with computer virus, data corruption,
delay, interruption, unauthorised access or unauthorised amendment.
_______________________________________________________________________________


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

<<inline: image001.png>>

_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to