Is there a way to Catch if the childrencollection of a canvas in Silverlight has changed? (when a child is added or removed)
I know the ObservableCollection has such an event, how could i rase one for my Canvas?
Is there a way to Catch if the childrencollection of a canvas in Silverlight has changed? (when a child is added or removed)
I know the ObservableCollection has such an event, how could i rase one for my Canvas?
No such event is raised by UIElementCollection or the Canvas object, however, adding or removing an element from Canvas.Children collection will trigger measure pass followed by an layout update pass, meaning the LayoutUpdated event will be raised, however the event is also raised in many cases (like resizing). This is the closes you can get to knowing a canvas's child collection could have been modified, unless you do all the adding and removing yourself.
The only responsibility of a Panel is setting the position and size of its children. This is done in MeasureOverride and ArrangeOverride, two somewhat 'pure' procedures. Inherit from ItemsControl to get more control.