public Collection<XLinkRow> Rows >>>> { >>>> get { return _Rows; } >>>> set >>>> { >>>> _Rows = value; >>>> _LoadRows(); >>>> } >>>> }You wire up the event handlers to an instance of Collection< XLinkRow > then replace it with another one. Needs a redesign really but you can use this instead:
public Collection<XLinkRow> Rows >>>> { >>>> get { return _Rows; } >>>> set >>>> { >>>> _Rows.Clear(); >>>> foreach (XLinkRow x in value) >>>> Rows.Add(x); >>>> } >>>> }>>>
>private Collection<XLinkRow> _Rows = new Collection<XLinkRow>(); >public Collection<XLinkRow> Rows >{ > get { return _Rows; } > set > { > _Rows = value; > > _LoadRows(); > > _Rows.ItemAdded += _Rows_ItemAdded; > _Rows.ItemRemoved += _Rows_ItemRemoved; > _Rows.Cleared += _Rows_Cleared; > } >} >It's not clear to me why you need to replace the collection. You could do this in the Form1 constructor:
for (int i = 0; i < 35; i++) { XLinkRow Row = new XLinkRow(); Row.Name = "Row " + i.ToString(); Row.Caption = "Row " + i.ToString(); Row.Url = "www.Row" + i + ".com"; xLinkList1.AddRow(Row); }and just add a
_Rows.Add(Row);to the AddRow() method. Given that you would only need default accessors to the Rows property.