473,804 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested objects and INotifyProperty Changed

Hi,

I've created a Person-Object which implemts INotifyProperty Changed. This
Person-Object contains an Address-Object which implements
INotifyProperty Changed too.

Then I create a BindingList<Per son> which is the DataSource for my
BindingSource. I created some TextBoxes bound to this BindingSource like this:

Binding b = new Binding("Text", bindingSource, "Name");
Binding b = new Binding("Text", bindingSource, "Address.Street ");

Updating the Name-Property works fine and I get a ListChanged-Event but when
I update the Street-Property I never get a ListChanged-Event.

What am I doing wrong?
Betina
Mar 16 '06 #1
4 5863
Hi Betina,
the problem you are having is because you are databinding to the Person
object, because you have a list of peolpe at the underlying datasource. What
you need to do is make sure that when the Address object raises the
PRopertyChanged event that the Person class that contains the event captures
the event and also raises a PropertyChanged event, then both the person and
addres controls should update.

Hope that helps
Mark Dawson
http://www.markdawson.org
"Betina" wrote:
Hi,

I've created a Person-Object which implemts INotifyProperty Changed. This
Person-Object contains an Address-Object which implements
INotifyProperty Changed too.

Then I create a BindingList<Per son> which is the DataSource for my
BindingSource. I created some TextBoxes bound to this BindingSource like this:

Binding b = new Binding("Text", bindingSource, "Name");
Binding b = new Binding("Text", bindingSource, "Address.Street ");

Updating the Name-Property works fine and I get a ListChanged-Event but when
I update the Street-Property I never get a ListChanged-Event.

What am I doing wrong?
Betina

Mar 16 '06 #2
Hi Mark,

is this the only way to make it work? I load the private member of the
objects through reflection and there's no easy way to capture events.

Is there any possibilty to capture this events in the bindinglist? I'm
working with a derived class and I think changing this class would be a more
general solution.
Thanks for your answer.
Betina

"Mark R. Dawson" wrote:
Hi Betina,
the problem you are having is because you are databinding to the Person
object, because you have a list of peolpe at the underlying datasource. What
you need to do is make sure that when the Address object raises the
PRopertyChanged event that the Person class that contains the event captures
the event and also raises a PropertyChanged event, then both the person and
addres controls should update.

Hope that helps
Mark Dawson
http://www.markdawson.org
"Betina" wrote:
Hi,

I've created a Person-Object which implemts INotifyProperty Changed. This
Person-Object contains an Address-Object which implements
INotifyProperty Changed too.

Then I create a BindingList<Per son> which is the DataSource for my
BindingSource. I created some TextBoxes bound to this BindingSource like this:

Binding b = new Binding("Text", bindingSource, "Name");
Binding b = new Binding("Text", bindingSource, "Address.Street ");

Updating the Name-Property works fine and I get a ListChanged-Event but when
I update the Street-Property I never get a ListChanged-Event.

What am I doing wrong?
Betina

Mar 16 '06 #3
Hi Betina,
I am not sure I am exactly following you, if you can do the folowing:
Then I create a BindingList<Per son> which is the DataSource for my
BindingSource. I created some TextBoxes bound to this BindingSource like this:

Binding b = new Binding("Text", bindingSource, "Name");
Binding b = new Binding("Text", bindingSource, "Address.Street ");

Then you must have access to the bindingsource and the list of people so you
can write some code like:

foreach(Person p in people)
{
// wire up p.Address.Prope rtyChanged to some event handler in P
}

Do you not have access to these things?
--
http://www.markdawson.org
"Betina" wrote:
Hi Mark,

is this the only way to make it work? I load the private member of the
objects through reflection and there's no easy way to capture events.

Is there any possibilty to capture this events in the bindinglist? I'm
working with a derived class and I think changing this class would be a more
general solution.
Thanks for your answer.
Betina

"Mark R. Dawson" wrote:
Hi Betina,
the problem you are having is because you are databinding to the Person
object, because you have a list of peolpe at the underlying datasource. What
you need to do is make sure that when the Address object raises the
PRopertyChanged event that the Person class that contains the event captures
the event and also raises a PropertyChanged event, then both the person and
addres controls should update.

Hope that helps
Mark Dawson
http://www.markdawson.org
"Betina" wrote:
Hi,

I've created a Person-Object which implemts INotifyProperty Changed. This
Person-Object contains an Address-Object which implements
INotifyProperty Changed too.

Then I create a BindingList<Per son> which is the DataSource for my
BindingSource. I created some TextBoxes bound to this BindingSource like this:

Binding b = new Binding("Text", bindingSource, "Name");
Binding b = new Binding("Text", bindingSource, "Address.Street ");

Updating the Name-Property works fine and I get a ListChanged-Event but when
I update the Street-Property I never get a ListChanged-Event.

What am I doing wrong?
Betina

Mar 17 '06 #4
Hi Mark,

yes, I have access to these things and I think it should be possible. I read
about the IRaiseItemChang edEvents and I will give it a try.

Thank you.

Betina

"Mark R. Dawson" wrote:
Hi Betina,
I am not sure I am exactly following you, if you can do the folowing:
> Then I create a BindingList<Per son> which is the DataSource for my
> BindingSource. I created some TextBoxes bound to this BindingSource like this:
>
> Binding b = new Binding("Text", bindingSource, "Name");
> Binding b = new Binding("Text", bindingSource, "Address.Street ");


Then you must have access to the bindingsource and the list of people so you
can write some code like:

foreach(Person p in people)
{
// wire up p.Address.Prope rtyChanged to some event handler in P
}

Do you not have access to these things?
--
http://www.markdawson.org
"Betina" wrote:
Hi Mark,

is this the only way to make it work? I load the private member of the
objects through reflection and there's no easy way to capture events.

Is there any possibilty to capture this events in the bindinglist? I'm
working with a derived class and I think changing this class would be a more
general solution.
Thanks for your answer.
Betina

"Mark R. Dawson" wrote:
Hi Betina,
the problem you are having is because you are databinding to the Person
object, because you have a list of peolpe at the underlying datasource. What
you need to do is make sure that when the Address object raises the
PRopertyChanged event that the Person class that contains the event captures
the event and also raises a PropertyChanged event, then both the person and
addres controls should update.

Hope that helps
Mark Dawson
http://www.markdawson.org
"Betina" wrote:

> Hi,
>
> I've created a Person-Object which implemts INotifyProperty Changed. This
> Person-Object contains an Address-Object which implements
> INotifyProperty Changed too.
>
> Then I create a BindingList<Per son> which is the DataSource for my
> BindingSource. I created some TextBoxes bound to this BindingSource like this:
>
> Binding b = new Binding("Text", bindingSource, "Name");
> Binding b = new Binding("Text", bindingSource, "Address.Street ");
>
> Updating the Name-Property works fine and I get a ListChanged-Event but when
> I update the Street-Property I never get a ListChanged-Event.
>
> What am I doing wrong?
>
>
> Betina
>
>

Mar 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
29642
by: Joshua Beall | last post by:
Hi All, I remember reading that both nested classes and namespaces would be available in PHP5. I know that namespaces got canceled (much sadness...), however, I *thought* that nested classes were still an option. However, I am coming up dry looking for information on how to do this, and the most recent references I am able to find to nested classes in PHP are dated 2003. And they all say the same thing: sorry, can't do that.
25
12717
by: chad | last post by:
I am writing a program to do some reliability calculations that require several nested for-loops. However, I believe that as the models become more complex, the number of required for-loops will increase. Does Python have a limit on the number of nested for-loops? Thanks.
3
4965
by: Furty | last post by:
Hi, I'm looking for the best practice for creating a generic data validation implementation for my data bound business objects. I currently have a business object base class implementing the following interfaces: IEditableObject, ICloneable, INotifyPropertyChanged, and IDataErrorInfo More specifically, my IDataErrorInfo implementation is like so:
37
2796
by: Tim N. van der Leeuw | last post by:
Hi, The following might be documented somewhere, but it hit me unexpectedly and I couldn't exactly find this in the manual either. Problem is, that I cannot use augmented assignment operators in a nested scope, on variables from the outer scope: PythonWin 2.4.3 (#69, Mar 29 2006, 17:35:34) on win32. Portions Copyright 1994-2004 Mark Hammond (mhammond@skippinet.com.au) -
1
2128
by: Hardeek Thakkar | last post by:
Dear friends, In my current project I am using the CustomCollections with the help of BindingList<Tgeneric class to store the database records instead using DataSet objects as offline database identities. Now I do have a large number of property classes each having a large number of properties in it. I want to implement the INotifyPropertyChanged interface in every
1
3365
by: Gokul | last post by:
Hi, I'm using indexed properties in an object which acts as the binding source. How can I implement INotifyPropertyChanged for that object so that when the indexed property is updated, binding target is updated? To be more specific please find the code below.. public class ClassA : INotifyPropertyChanged
2
2220
by: Merk | last post by:
I'm new to .NET (using 2.0) and was wondering how to go about binding a collection of custom classes to a DataGrid. The class exposes 5 read-only String properties. I would like for each of these properties to appear in a column in the DataGrid. The end result would be that when the collection has 35 objects in it, the DataGrid would have 35 rows and 5 columns (after being bound to the collection).
2
2278
by: John Greenwood | last post by:
Hi, I'm not sure if i'm misunderstanding how INotifyPropertyChanged should work but it's not working as I expected. I have a sample program with a very simple 'Customer' class with three properties code, name & address. All these are bound to a form via a BindingSource and fire the PropertyChanged event when the property is modified.
1
1471
by: BillG | last post by:
I am used to dealing with recordsets and I am using a coarse-grained object and need to know if I am doing it correctly. I have a class named Activity which represents an event being planned (golf outing, dinner dance etc.). The Activity hold a list of Registrations which represents some company or individual reserving a spot at the activity. The Registration class holds a list of Attendees which represents the individuals being...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.