When a data context changes, it should be notified to all descendant controls who inherit the data context. This allows the `SelectingItemsControl` to defer setting the selected item until the `DataContext` has changed for the whole tree.
Renamed `OnDataContextChanging`/`OnDataContextChanged` to `OnDataContextBeginUpdate`/`OnDataContextEndUpdate` because `DataContextChanged` is now called from the property changed notification.
Fixes#507.
Previously it wasn't clear which constructor on `InstancedBinding` must be called for a particular binding mode. Refactored the constructors:
- We now have a single public ctor which takes an `ISubject`, as a subject can be used for all binding modes.
- Instanced bindings with other sources such as single values and `IObservables` are now constructed via static methods which only allow the correct sources for that binding mode
Shapes with Strech set to Fill would fail to size themselves correctly
when an infinite available size was passed to messure. This occurs
because the transform is calculated before a final size is known.
A flag was added that signals ArrangeOverride to calculate the
transform for the RenderedGeometry
Otherwise if `TextBox.CaretIndex` is set before the `TextBox`'s template is applied then it will be coerced to null on the `TextPresenter` when created as `Text` will still be null at this point.
Previously, if the user overrode `OnAttachedToVisualTree` or `OnDetachedFromVisualTree` and forgot to call the base implementation, the events wouldn't be raised. It's very important that these events get raised so moved the code to raise them to `OnAttachedToVisualTreeCore`/`OnDetachedFromVisualTreeCore`.
Previously, if the user overrode `OnAttachedToLogicalTree` or `OnDetachedFromLogicalTree` and forgot to call the base implementation, the events wouldn't be raised. It's very important that these events get raised so moved the code to raise them to `OnAttachedToLogicalTreeCore`/`OnDetachedFromLogicalTreeCore`.
When a captured control is removed from the visual tree, clear the mouse capture.
Note that our capture logic needs to be improved - it shouldn't be possible to capture a non-visible or non-enabled control. This doesn't address that but it does fix the crash in #1203.
Fixes#1203