silverlight - Silverlight4 + C#: Using INotifyPropertyChanged in a UserControl to notify another UserControl is not notifying -


I have many user controls in the project, and one of them retrieves items from an XML, thus "Object ClassItem" And should inform other user control information about those items.

I have created a square for my object ("all" items will be):

  public class class item {public id id (get; set;} public String type {get} set;}}  

I have another class that is used to inform other user controls when an object of type "ClassItem" is created:

  public class class 2: INotifyPropertyChanged {// property public supervision Submit  Item Collection {Events}; Internal Set; // Events; Public Events Property Converted AventHandler Property Converted; // Ways Public Zero ShowItems () {ItemsCollection = New ObservableCollection & Class; ClassItem & gt; (); If (property changed! = Null) {property changed (this, new property changing events ("itemcollection"));}}}  

data comes from an XML file Which is parsed for creating types of objects ClassItem:

Zero DisplayItems (string xmlContent) {XDocument xmlItems = XDocument.Parse (xmlContent); Var items = items from xmlItems.Descendants ("item") Select new class idam {id = (int) item. Element ("id"), type = (string) item Element ("type)}}}

If I am not mistaken, then it is to parse XML and creates class e-comma objects for each item in XML. New class item object is created, it should be ignited Notification for all UserControls that are "bound" for "item compilation" notifications, they are defined in class 2.

2 does not seem to run the code :-( And There are no notifications

Post-text "itemprop =" text ">

The notification is to use the property to work. I will not see any place in that code where you are setting an item to" itemscollection ".

I usually follow this method:

  Public supervision selection  item collection {get return_time collection;} set {_itemsCollection = value; NotifyPropertyChanged ("ItemsCollection");}}  

Then update ItemsCollection.

// Instruction before using ObservableCollection Item Compilation = New Observational Collection & lt; Square element & gt; (); // Then create your data, however you need it. Var ResultsData = GateData (); Update the Observeable Collection Property, which will send the notification (classItem) to the notification (in the resulting data in different classes etc.); }

Comments