diff --git a/dev/Generated/MetadataSummary.cs b/dev/Generated/MetadataSummary.cs index c130fed04b..fe1c6a6ba6 100644 --- a/dev/Generated/MetadataSummary.cs +++ b/dev/Generated/MetadataSummary.cs @@ -444,9 +444,9 @@ public MetadataSummary() IncludedTypesMetadata["Scroller"] = true; // Scroller -- NeedsPropChangedCallbackMetadata NeedsPropChangedCallbackMetadata["Scroller.Background"] = true; - NeedsPropChangedCallbackMetadata["Scroller.Child"] = true; NeedsPropChangedCallbackMetadata["Scroller.ComputedHorizontalScrollMode"] = true; NeedsPropChangedCallbackMetadata["Scroller.ComputedVerticalScrollMode"] = true; + NeedsPropChangedCallbackMetadata["Scroller.Content"] = true; NeedsPropChangedCallbackMetadata["Scroller.HorizontalAnchorRatio"] = true; PropValidationCallbackMetadata["Scroller.HorizontalAnchorRatio"] = "ValidateAnchorRatio"; NeedsPropChangedCallbackMetadata["Scroller.HorizontalScrollChainingMode"] = true; diff --git a/dev/Generated/Scroller.properties.cpp b/dev/Generated/Scroller.properties.cpp index 6457ad0b81..d36545209d 100644 --- a/dev/Generated/Scroller.properties.cpp +++ b/dev/Generated/Scroller.properties.cpp @@ -9,9 +9,9 @@ CppWinRTActivatableClassWithDPFactory(Scroller) GlobalDependencyProperty ScrollerProperties::s_BackgroundProperty{ nullptr }; -GlobalDependencyProperty ScrollerProperties::s_ChildProperty{ nullptr }; GlobalDependencyProperty ScrollerProperties::s_ComputedHorizontalScrollModeProperty{ nullptr }; GlobalDependencyProperty ScrollerProperties::s_ComputedVerticalScrollModeProperty{ nullptr }; +GlobalDependencyProperty ScrollerProperties::s_ContentProperty{ nullptr }; GlobalDependencyProperty ScrollerProperties::s_HorizontalAnchorRatioProperty{ nullptr }; GlobalDependencyProperty ScrollerProperties::s_HorizontalScrollChainingModeProperty{ nullptr }; GlobalDependencyProperty ScrollerProperties::s_HorizontalScrollModeProperty{ nullptr }; @@ -56,17 +56,6 @@ void ScrollerProperties::EnsureProperties() ValueHelper::BoxedDefaultValue(), winrt::PropertyChangedCallback(&OnPropertyChanged)); } - if (!s_ChildProperty) - { - s_ChildProperty = - InitializeDependencyProperty( - L"Child", - winrt::name_of(), - winrt::name_of(), - false /* isAttached */, - ValueHelper::BoxedDefaultValue(), - winrt::PropertyChangedCallback(&OnPropertyChanged)); - } if (!s_ComputedHorizontalScrollModeProperty) { s_ComputedHorizontalScrollModeProperty = @@ -89,6 +78,17 @@ void ScrollerProperties::EnsureProperties() ValueHelper::BoxValueIfNecessary(Scroller::s_defaultComputedVerticalScrollMode), winrt::PropertyChangedCallback(&OnPropertyChanged)); } + if (!s_ContentProperty) + { + s_ContentProperty = + InitializeDependencyProperty( + L"Content", + winrt::name_of(), + winrt::name_of(), + false /* isAttached */, + ValueHelper::BoxedDefaultValue(), + winrt::PropertyChangedCallback(&OnPropertyChanged)); + } if (!s_HorizontalAnchorRatioProperty) { s_HorizontalAnchorRatioProperty = @@ -281,9 +281,9 @@ void ScrollerProperties::EnsureProperties() void ScrollerProperties::ClearProperties() { s_BackgroundProperty = nullptr; - s_ChildProperty = nullptr; s_ComputedHorizontalScrollModeProperty = nullptr; s_ComputedVerticalScrollModeProperty = nullptr; + s_ContentProperty = nullptr; s_HorizontalAnchorRatioProperty = nullptr; s_HorizontalScrollChainingModeProperty = nullptr; s_HorizontalScrollModeProperty = nullptr; @@ -355,16 +355,6 @@ winrt::Brush ScrollerProperties::Background() return ValueHelper::CastOrUnbox(static_cast(this)->GetValue(s_BackgroundProperty)); } -void ScrollerProperties::Child(winrt::UIElement const& value) -{ - static_cast(this)->SetValue(s_ChildProperty, ValueHelper::BoxValueIfNecessary(value)); -} - -winrt::UIElement ScrollerProperties::Child() -{ - return ValueHelper::CastOrUnbox(static_cast(this)->GetValue(s_ChildProperty)); -} - void ScrollerProperties::ComputedHorizontalScrollMode(winrt::ScrollMode const& value) { static_cast(this)->SetValue(s_ComputedHorizontalScrollModeProperty, ValueHelper::BoxValueIfNecessary(value)); @@ -385,6 +375,16 @@ winrt::ScrollMode ScrollerProperties::ComputedVerticalScrollMode() return ValueHelper::CastOrUnbox(static_cast(this)->GetValue(s_ComputedVerticalScrollModeProperty)); } +void ScrollerProperties::Content(winrt::UIElement const& value) +{ + static_cast(this)->SetValue(s_ContentProperty, ValueHelper::BoxValueIfNecessary(value)); +} + +winrt::UIElement ScrollerProperties::Content() +{ + return ValueHelper::CastOrUnbox(static_cast(this)->GetValue(s_ContentProperty)); +} + void ScrollerProperties::HorizontalAnchorRatio(double value) { static_cast(this)->ValidateAnchorRatio(value); diff --git a/dev/Generated/Scroller.properties.h b/dev/Generated/Scroller.properties.h index e270a473a8..909ced8353 100644 --- a/dev/Generated/Scroller.properties.h +++ b/dev/Generated/Scroller.properties.h @@ -12,15 +12,15 @@ class ScrollerProperties void Background(winrt::Brush const& value); winrt::Brush Background(); - void Child(winrt::UIElement const& value); - winrt::UIElement Child(); - void ComputedHorizontalScrollMode(winrt::ScrollMode const& value); winrt::ScrollMode ComputedHorizontalScrollMode(); void ComputedVerticalScrollMode(winrt::ScrollMode const& value); winrt::ScrollMode ComputedVerticalScrollMode(); + void Content(winrt::UIElement const& value); + winrt::UIElement Content(); + void HorizontalAnchorRatio(double value); double HorizontalAnchorRatio(); @@ -73,9 +73,9 @@ class ScrollerProperties winrt::ZoomMode ZoomMode(); static winrt::DependencyProperty BackgroundProperty() { return s_BackgroundProperty; } - static winrt::DependencyProperty ChildProperty() { return s_ChildProperty; } static winrt::DependencyProperty ComputedHorizontalScrollModeProperty() { return s_ComputedHorizontalScrollModeProperty; } static winrt::DependencyProperty ComputedVerticalScrollModeProperty() { return s_ComputedVerticalScrollModeProperty; } + static winrt::DependencyProperty ContentProperty() { return s_ContentProperty; } static winrt::DependencyProperty HorizontalAnchorRatioProperty() { return s_HorizontalAnchorRatioProperty; } static winrt::DependencyProperty HorizontalScrollChainingModeProperty() { return s_HorizontalScrollChainingModeProperty; } static winrt::DependencyProperty HorizontalScrollModeProperty() { return s_HorizontalScrollModeProperty; } @@ -95,9 +95,9 @@ class ScrollerProperties static winrt::DependencyProperty ZoomModeProperty() { return s_ZoomModeProperty; } static GlobalDependencyProperty s_BackgroundProperty; - static GlobalDependencyProperty s_ChildProperty; static GlobalDependencyProperty s_ComputedHorizontalScrollModeProperty; static GlobalDependencyProperty s_ComputedVerticalScrollModeProperty; + static GlobalDependencyProperty s_ContentProperty; static GlobalDependencyProperty s_HorizontalAnchorRatioProperty; static GlobalDependencyProperty s_HorizontalScrollChainingModeProperty; static GlobalDependencyProperty s_HorizontalScrollModeProperty; diff --git a/dev/Generated/ScrollerTestHooks.properties.cpp b/dev/Generated/ScrollerTestHooks.properties.cpp index 61ea82899f..88fb4a3a63 100644 --- a/dev/Generated/ScrollerTestHooks.properties.cpp +++ b/dev/Generated/ScrollerTestHooks.properties.cpp @@ -11,8 +11,8 @@ CppWinRTActivatableClassWithBasicFactory(ScrollerTestHooks) ScrollerTestHooksProperties::ScrollerTestHooksProperties() : m_anchorEvaluatedEventSource{static_cast(this)} - , m_childLayoutOffsetXChangedEventSource{static_cast(this)} - , m_childLayoutOffsetYChangedEventSource{static_cast(this)} + , m_contentLayoutOffsetXChangedEventSource{static_cast(this)} + , m_contentLayoutOffsetYChangedEventSource{static_cast(this)} , m_interactionSourcesChangedEventSource{static_cast(this)} { } @@ -35,24 +35,24 @@ void ScrollerTestHooksProperties::AnchorEvaluated(winrt::event_token const& toke m_anchorEvaluatedEventSource.remove(token); } -winrt::event_token ScrollerTestHooksProperties::ChildLayoutOffsetXChanged(winrt::TypedEventHandler const& value) +winrt::event_token ScrollerTestHooksProperties::ContentLayoutOffsetXChanged(winrt::TypedEventHandler const& value) { - return m_childLayoutOffsetXChangedEventSource.add(value); + return m_contentLayoutOffsetXChangedEventSource.add(value); } -void ScrollerTestHooksProperties::ChildLayoutOffsetXChanged(winrt::event_token const& token) +void ScrollerTestHooksProperties::ContentLayoutOffsetXChanged(winrt::event_token const& token) { - m_childLayoutOffsetXChangedEventSource.remove(token); + m_contentLayoutOffsetXChangedEventSource.remove(token); } -winrt::event_token ScrollerTestHooksProperties::ChildLayoutOffsetYChanged(winrt::TypedEventHandler const& value) +winrt::event_token ScrollerTestHooksProperties::ContentLayoutOffsetYChanged(winrt::TypedEventHandler const& value) { - return m_childLayoutOffsetYChangedEventSource.add(value); + return m_contentLayoutOffsetYChangedEventSource.add(value); } -void ScrollerTestHooksProperties::ChildLayoutOffsetYChanged(winrt::event_token const& token) +void ScrollerTestHooksProperties::ContentLayoutOffsetYChanged(winrt::event_token const& token) { - m_childLayoutOffsetYChangedEventSource.remove(token); + m_contentLayoutOffsetYChangedEventSource.remove(token); } winrt::event_token ScrollerTestHooksProperties::InteractionSourcesChanged(winrt::TypedEventHandler const& value) diff --git a/dev/Generated/ScrollerTestHooks.properties.h b/dev/Generated/ScrollerTestHooks.properties.h index 9668e52dcf..08f01ab36a 100644 --- a/dev/Generated/ScrollerTestHooks.properties.h +++ b/dev/Generated/ScrollerTestHooks.properties.h @@ -13,16 +13,16 @@ class ScrollerTestHooksProperties winrt::event_token AnchorEvaluated(winrt::TypedEventHandler const& value); void AnchorEvaluated(winrt::event_token const& token); - winrt::event_token ChildLayoutOffsetXChanged(winrt::TypedEventHandler const& value); - void ChildLayoutOffsetXChanged(winrt::event_token const& token); - winrt::event_token ChildLayoutOffsetYChanged(winrt::TypedEventHandler const& value); - void ChildLayoutOffsetYChanged(winrt::event_token const& token); + winrt::event_token ContentLayoutOffsetXChanged(winrt::TypedEventHandler const& value); + void ContentLayoutOffsetXChanged(winrt::event_token const& token); + winrt::event_token ContentLayoutOffsetYChanged(winrt::TypedEventHandler const& value); + void ContentLayoutOffsetYChanged(winrt::event_token const& token); winrt::event_token InteractionSourcesChanged(winrt::TypedEventHandler const& value); void InteractionSourcesChanged(winrt::event_token const& token); event_source> m_anchorEvaluatedEventSource; - event_source> m_childLayoutOffsetXChangedEventSource; - event_source> m_childLayoutOffsetYChangedEventSource; + event_source> m_contentLayoutOffsetXChangedEventSource; + event_source> m_contentLayoutOffsetYChangedEventSource; event_source> m_interactionSourcesChangedEventSource; static void EnsureProperties(); diff --git a/dev/ParallaxView/APITests/ParallaxViewTests.cs b/dev/ParallaxView/APITests/ParallaxViewTests.cs index 08d06d8e0d..090d4a4630 100644 --- a/dev/ParallaxView/APITests/ParallaxViewTests.cs +++ b/dev/ParallaxView/APITests/ParallaxViewTests.cs @@ -68,8 +68,8 @@ public class ParallaxViewTests private const double c_scrollerMaxOverpanRatio = 1.0; // Scroller's maximum underpan/viewport and overpan/viewport ratio private const double c_defaultUIScrollerWidth = 200.0; private const double c_defaultUIScrollerHeight = 100.0; - private const double c_defaultUIScrollerChildWidth = 1200.0; - private const double c_defaultUIScrollerChildHeight = 600.0; + private const double c_defaultUIScrollerContentWidth = 1200.0; + private const double c_defaultUIScrollerContentHeight = 600.0; private const double c_defaultUIFinalScrollerHorizontalOffset = 100.0; private const double c_defaultUIFinalScrollerVerticalOffset = 50.0; private const double c_defaultUIScrollViewerWidth = 200.0; @@ -297,10 +297,10 @@ public void VerifyBasicParallaxingWithScroller() { const double expectedHorizontalShift = (c_defaultUIScrollerWidth * c_scrollerMaxOverpanRatio + c_defaultUIFinalScrollerHorizontalOffset) * c_defaultUIHorizontalShift / - (c_defaultUIScrollerWidth * c_scrollerMaxOverpanRatio * 2.0 + (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth)); + (c_defaultUIScrollerWidth * c_scrollerMaxOverpanRatio * 2.0 + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth)); const double expectedVerticalShift = (c_defaultUIScrollerHeight * c_scrollerMaxOverpanRatio + c_defaultUIFinalScrollerVerticalOffset) * c_defaultUIVerticalShift / - (c_defaultUIScrollerHeight * c_scrollerMaxOverpanRatio * 2.0 + (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight)); + (c_defaultUIScrollerHeight * c_scrollerMaxOverpanRatio * 2.0 + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight)); VerifyParallaxingWithDefaultSourceUI( sourceType: SourceType.Scroller, @@ -325,7 +325,7 @@ public void VerifyParallaxingWithAbsoluteExtremes() ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - Rectangle rectangleSVChild = null; + Rectangle rectangleSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -336,13 +336,13 @@ public void VerifyParallaxingWithAbsoluteExtremes() { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - rectangleSVChild = new Rectangle(); + rectangleSVContent = new Rectangle(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); SetupDefaultUIWithScrollViewer( - parallaxView, rectanglePVChild, scrollViewer, rectangleSVChild, + parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent); parallaxView.HorizontalSourceOffsetKind = ParallaxSourceOffsetKind.Absolute; @@ -420,7 +420,7 @@ public void VerifyParallaxingWithZooming() ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - Rectangle rectangleSVChild = null; + Rectangle rectangleSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -431,13 +431,13 @@ public void VerifyParallaxingWithZooming() { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - rectangleSVChild = new Rectangle(); + rectangleSVContent = new Rectangle(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); SetupDefaultUIWithScrollViewer( - parallaxView, rectanglePVChild, scrollViewer, rectangleSVChild, + parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent); scrollViewer.ZoomMode = Windows.UI.Xaml.Controls.ZoomMode.Enabled; @@ -633,7 +633,7 @@ public void VerifyParallaxingWithSizeChanges() ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - Rectangle rectangleSVChild = null; + Rectangle rectangleSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -644,13 +644,13 @@ public void VerifyParallaxingWithSizeChanges() { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - rectangleSVChild = new Rectangle(); + rectangleSVContent = new Rectangle(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); SetupDefaultUIWithScrollViewer( - parallaxView, rectanglePVChild, scrollViewer, rectangleSVChild, + parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent); }); @@ -760,8 +760,8 @@ public void VerifyParallaxingWithSizeChanges() Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance(offset, (float)-expectedVerticalShift, c_shiftTolerance)); Log.Comment("Decreasing the ScrollViewer.Content's Width and increasing its Height"); - rectangleSVChild.Width -= 20.0; - rectangleSVChild.Height += 20.0; + rectangleSVContent.Width -= 20.0; + rectangleSVContent.Height += 20.0; Log.Comment("Setting up spy property set"); CompositionPropertySpy.StartSpyingScalarProperty(visualPPChild, GetVisualHorizontalTargetedPropertyName()); @@ -895,7 +895,7 @@ public void VerifyParallaxViewOffsetChangeInsideScrollViewer() ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - StackPanel stackPanelSVChild = null; + StackPanel stackPanelSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -906,14 +906,14 @@ public void VerifyParallaxViewOffsetChangeInsideScrollViewer() { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - stackPanelSVChild = new StackPanel(); + stackPanelSVContent = new StackPanel(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); SetupUIWithParallaxViewInsideScrollViewer( verticalParallaxViewOffset1, - parallaxView, rectanglePVChild, scrollViewer, stackPanelSVChild, + parallaxView, rectanglePVChild, scrollViewer, stackPanelSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent); }); @@ -926,8 +926,8 @@ public void VerifyParallaxViewOffsetChangeInsideScrollViewer() { Verify.AreEqual(scrollViewer.ActualWidth, c_defaultUIScrollViewerWidth); Verify.AreEqual(scrollViewer.ActualHeight, c_defaultUIScrollViewerHeight); - Verify.AreEqual(stackPanelSVChild.ActualWidth, c_defaultUIScrollViewerWidth); - Verify.AreEqual(stackPanelSVChild.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset1); + Verify.AreEqual(stackPanelSVContent.ActualWidth, c_defaultUIScrollViewerWidth); + Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset1); Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollViewerWidth); Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollViewerHeight / 2.0); Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollViewerWidth); @@ -956,7 +956,7 @@ public void VerifyParallaxViewOffsetChangeInsideScrollViewer() Verify.IsTrue(CompositionPropertyLogger.AreFloatsEqualWithTolerance((float)finalVerticalShift, (float)-expectedVerticalShift1, c_shiftTolerance)); Log.Comment("Changing the vertical offset of the ParallaxView within the ScrollViewer.Content"); - Rectangle rectangle = stackPanelSVChild.Children[0] as Rectangle; + Rectangle rectangle = stackPanelSVContent.Children[0] as Rectangle; rectangle.Height = verticalParallaxViewOffset2; Log.Comment("Invoking ParallaxView.RefreshAutomaticVerticalOffsets() to update the vertical shift."); @@ -971,7 +971,7 @@ public void VerifyParallaxViewOffsetChangeInsideScrollViewer() RunOnUIThread.Execute(() => { - Verify.AreEqual(stackPanelSVChild.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset2); + Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset2); Log.Comment("Cancelling spying"); CompositionPropertySpy.StopSpyingProperty(visualPPChild, GetVisualVerticalTargetedPropertyName()); @@ -1010,7 +1010,7 @@ private void VerifyParallaxingWithDefaultSourceUI( Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; Scroller scroller = null; - Rectangle rectangleSVChild = null; + Rectangle rectangleSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent sourceLoadedEvent = null; @@ -1021,7 +1021,7 @@ private void VerifyParallaxingWithDefaultSourceUI( { parallaxViewLoadedEvent = new AutoResetEvent(false); sourceLoadedEvent = new AutoResetEvent(false); - rectangleSVChild = new Rectangle(); + rectangleSVContent = new Rectangle(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); @@ -1029,14 +1029,14 @@ private void VerifyParallaxingWithDefaultSourceUI( { scrollViewer = new ScrollViewer(); SetupDefaultUIWithScrollViewer( - parallaxView, rectanglePVChild, scrollViewer, rectangleSVChild, + parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent, parallaxViewLoadedEvent, sourceLoadedEvent); } else { scroller = new Scroller(); SetupDefaultUIWithScroller( - parallaxView, rectanglePVChild, scroller, rectangleSVChild, + parallaxView, rectanglePVChild, scroller, rectangleSVContent, parallaxViewLoadedEvent, sourceLoadedEvent); } @@ -1131,7 +1131,7 @@ private void VerifyParallaxingWithParallaxViewInsideScrollViewer( ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - StackPanel stackPanelSVChild = null; + StackPanel stackPanelSVContent = null; Visual visualPPChild = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -1142,14 +1142,14 @@ private void VerifyParallaxingWithParallaxViewInsideScrollViewer( { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - stackPanelSVChild = new StackPanel(); + stackPanelSVContent = new StackPanel(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); SetupUIWithParallaxViewInsideScrollViewer( verticalParallaxViewOffset, - parallaxView, rectanglePVChild, scrollViewer, stackPanelSVChild, + parallaxView, rectanglePVChild, scrollViewer, stackPanelSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent); parallaxView.VerticalSourceOffsetKind = verticalSourceOffsetKind; @@ -1168,8 +1168,8 @@ private void VerifyParallaxingWithParallaxViewInsideScrollViewer( { Verify.AreEqual(scrollViewer.ActualWidth, c_defaultUIScrollViewerWidth); Verify.AreEqual(scrollViewer.ActualHeight, c_defaultUIScrollViewerHeight); - Verify.AreEqual(stackPanelSVChild.ActualWidth, c_defaultUIScrollViewerWidth); - Verify.AreEqual(stackPanelSVChild.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset); + Verify.AreEqual(stackPanelSVContent.ActualWidth, c_defaultUIScrollViewerWidth); + Verify.AreEqual(stackPanelSVContent.ActualHeight, c_defaultUIScrollViewerHeight * 3.5 + verticalParallaxViewOffset); Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollViewerWidth); Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollViewerHeight / 2.0); Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollViewerWidth); @@ -1262,11 +1262,11 @@ private void VerifyParallaxingWithParallaxViewInsideScroller( Verify.AreEqual(scroller.ActualWidth, c_defaultUIScrollerWidth); Verify.AreEqual(scroller.ActualHeight, c_defaultUIScrollerHeight); - Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollerChildWidth); - Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollerChildHeight); + Verify.AreEqual(parallaxView.ActualWidth, c_defaultUIScrollerContentWidth); + Verify.AreEqual(parallaxView.ActualHeight, c_defaultUIScrollerContentHeight); - Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollerChildWidth + c_defaultUIHorizontalShift); - Verify.AreEqual(rectanglePVChild.ActualHeight, c_defaultUIScrollerChildHeight + c_defaultUIVerticalShift); + Verify.AreEqual(rectanglePVChild.ActualWidth, c_defaultUIScrollerContentWidth + c_defaultUIHorizontalShift); + Verify.AreEqual(rectanglePVChild.ActualHeight, c_defaultUIScrollerContentHeight + c_defaultUIVerticalShift); Log.Comment("Setting up spy property set"); visualPPChild = ElementCompositionPreview.GetElementVisual(rectanglePVChild); @@ -1405,7 +1405,7 @@ private void SetupDefaultUIWithScrollViewer( ParallaxView parallaxView, Rectangle rectanglePVChild, ScrollViewer scrollViewer, - Rectangle rectangleSVChild, + Rectangle rectangleSVContent, AutoResetEvent parallaxViewLoadedEvent, AutoResetEvent scrollViewerLoadedEvent) { @@ -1419,10 +1419,10 @@ private void SetupDefaultUIWithScrollViewer( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - Verify.IsNotNull(rectangleSVChild); - rectangleSVChild.Width = c_defaultUIScrollViewerContentWidth; - rectangleSVChild.Height = c_defaultUIScrollViewerContentHeight; - rectangleSVChild.Fill = twoColorLGB; + Verify.IsNotNull(rectangleSVContent); + rectangleSVContent.Width = c_defaultUIScrollViewerContentWidth; + rectangleSVContent.Height = c_defaultUIScrollViewerContentHeight; + rectangleSVContent.Fill = twoColorLGB; Verify.IsNotNull(scrollViewer); if (string.IsNullOrEmpty(scrollViewer.Name)) @@ -1434,7 +1434,7 @@ private void SetupDefaultUIWithScrollViewer( scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; scrollViewer.ZoomMode = Windows.UI.Xaml.Controls.ZoomMode.Disabled; - scrollViewer.Content = rectangleSVChild; + scrollViewer.Content = rectangleSVContent; Verify.IsNotNull(rectanglePVChild); rectanglePVChild.Width = c_defaultUIScrollViewerWidth + c_defaultHorizontalShift; @@ -1480,7 +1480,7 @@ private void SetupDefaultUIWithScroller( ParallaxView parallaxView, Rectangle rectanglePVChild, Scroller scroller, - Rectangle rectangleScrollerChild, + Rectangle rectangleScrollerContent, AutoResetEvent parallaxViewLoadedEvent, AutoResetEvent scrollerLoadedEvent) { @@ -1494,10 +1494,10 @@ private void SetupDefaultUIWithScroller( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - Verify.IsNotNull(rectangleScrollerChild); - rectangleScrollerChild.Width = c_defaultUIScrollerChildWidth; - rectangleScrollerChild.Height = c_defaultUIScrollerChildHeight; - rectangleScrollerChild.Fill = twoColorLGB; + Verify.IsNotNull(rectangleScrollerContent); + rectangleScrollerContent.Width = c_defaultUIScrollerContentWidth; + rectangleScrollerContent.Height = c_defaultUIScrollerContentHeight; + rectangleScrollerContent.Fill = twoColorLGB; Verify.IsNotNull(scroller); if (string.IsNullOrEmpty(scroller.Name)) @@ -1507,7 +1507,7 @@ private void SetupDefaultUIWithScroller( scroller.Width = c_defaultUIScrollerWidth; scroller.Height = c_defaultUIScrollerHeight; scroller.ZoomMode = ZoomMode.Disabled; - scroller.Child = rectangleScrollerChild; + scroller.Content = rectangleScrollerContent; Verify.IsNotNull(rectanglePVChild); rectanglePVChild.Width = c_defaultUIScrollerWidth + c_defaultHorizontalShift; @@ -1575,22 +1575,22 @@ private void SetupUIWithParallaxViewInsideScroller( scroller.Height = c_defaultUIScrollerHeight; scroller.ZoomMode = ZoomMode.Disabled; - Grid gridScrollerChild = new Grid(); - scroller.Child = gridScrollerChild; + Grid gridScrollerContent = new Grid(); + scroller.Content = gridScrollerContent; Verify.IsNotNull(rectanglePVChild); - rectanglePVChild.Width = c_defaultUIScrollerChildWidth + c_defaultUIHorizontalShift; - rectanglePVChild.Height = c_defaultUIScrollerChildHeight + c_defaultUIVerticalShift; + rectanglePVChild.Width = c_defaultUIScrollerContentWidth + c_defaultUIHorizontalShift; + rectanglePVChild.Height = c_defaultUIScrollerContentHeight + c_defaultUIVerticalShift; rectanglePVChild.Fill = twoColorLGB; Verify.IsNotNull(parallaxView); - parallaxView.Width = c_defaultUIScrollerChildWidth; - parallaxView.Height = c_defaultUIScrollerChildHeight; + parallaxView.Width = c_defaultUIScrollerContentWidth; + parallaxView.Height = c_defaultUIScrollerContentHeight; parallaxView.Child = rectanglePVChild; parallaxView.HorizontalShift = c_defaultUIHorizontalShift; parallaxView.VerticalShift = c_defaultUIVerticalShift; - gridScrollerChild.Children.Add(parallaxView); + gridScrollerContent.Children.Add(parallaxView); if (parallaxViewLoadedEvent != null) { @@ -1620,7 +1620,7 @@ private void SetupUIWithParallaxViewInsideScrollViewer( ParallaxView parallaxView, Rectangle rectanglePVChild, ScrollViewer scrollViewer, - StackPanel stackPanelSVChild, + StackPanel stackPanelSVContent, AutoResetEvent parallaxViewLoadedEvent, AutoResetEvent scrollViewerLoadedEvent) { @@ -1634,13 +1634,13 @@ private void SetupUIWithParallaxViewInsideScrollViewer( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - Verify.IsNotNull(stackPanelSVChild); - stackPanelSVChild.Width = c_defaultUIScrollViewerWidth; + Verify.IsNotNull(stackPanelSVContent); + stackPanelSVContent.Width = c_defaultUIScrollViewerWidth; if (verticalParallaxViewOffset > 0.0) { Rectangle rectangleChild = new Rectangle() { Width = c_defaultUIScrollViewerWidth, Height = verticalParallaxViewOffset, Fill = twoColorLGB }; - stackPanelSVChild.Children.Add(rectangleChild); + stackPanelSVContent.Children.Add(rectangleChild); } Verify.IsNotNull(rectanglePVChild); @@ -1655,12 +1655,12 @@ private void SetupUIWithParallaxViewInsideScrollViewer( parallaxView.VerticalShift = c_defaultUIVerticalShift; parallaxView.MaxVerticalShiftRatio = c_defaultMaxVerticalShiftRatio; - stackPanelSVChild.Children.Add(parallaxView); + stackPanelSVContent.Children.Add(parallaxView); for (int childRect = 0; childRect < 3; childRect++) { Rectangle rectangleChild = new Rectangle() { Width = c_defaultUIScrollViewerWidth, Height = c_defaultUIScrollViewerHeight, Fill = twoColorLGB }; - stackPanelSVChild.Children.Add(rectangleChild); + stackPanelSVContent.Children.Add(rectangleChild); } Verify.IsNotNull(scrollViewer); @@ -1669,7 +1669,7 @@ private void SetupUIWithParallaxViewInsideScrollViewer( scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; scrollViewer.ZoomMode = Windows.UI.Xaml.Controls.ZoomMode.Disabled; - scrollViewer.Content = stackPanelSVChild; + scrollViewer.Content = stackPanelSVContent; if (parallaxViewLoadedEvent != null) { @@ -1705,7 +1705,7 @@ private void ChangePropertyAfterParallaxViewDisposal(PropertyId propertyToChange ParallaxView parallaxView = null; Rectangle rectanglePVChild = null; ScrollViewer scrollViewer = null; - Rectangle rectangleSVChild = null; + Rectangle rectangleSVContent = null; AutoResetEvent parallaxViewLoadedEvent = null; AutoResetEvent scrollViewerLoadedEvent = null; @@ -1713,7 +1713,7 @@ private void ChangePropertyAfterParallaxViewDisposal(PropertyId propertyToChange { parallaxViewLoadedEvent = new AutoResetEvent(false); scrollViewerLoadedEvent = new AutoResetEvent(false); - rectangleSVChild = new Rectangle(); + rectangleSVContent = new Rectangle(); scrollViewer = new ScrollViewer(); rectanglePVChild = new Rectangle(); parallaxView = new ParallaxView(); @@ -1725,7 +1725,7 @@ private void ChangePropertyAfterParallaxViewDisposal(PropertyId propertyToChange }; SetupDefaultUIWithScrollViewer( - parallaxView, rectanglePVChild, scrollViewer, rectangleSVChild, + parallaxView, rectanglePVChild, scrollViewer, rectangleSVContent, parallaxViewLoadedEvent, scrollViewerLoadedEvent: null); parallaxView.Source = scrollViewer; @@ -1756,7 +1756,7 @@ private void ChangePropertyAfterParallaxViewDisposal(PropertyId propertyToChange break; case PropertyId.ScrollViewerContentHeight: Log.Comment("Changing ScrollViewer.Content.Height"); - rectangleSVChild.Height += 10; + rectangleSVContent.Height += 10; break; } }); diff --git a/dev/ParallaxView/ScrollInputHelper.cpp b/dev/ParallaxView/ScrollInputHelper.cpp index 45c33d77e9..3899d00170 100644 --- a/dev/ParallaxView/ScrollInputHelper.cpp +++ b/dev/ParallaxView/ScrollInputHelper.cpp @@ -21,7 +21,7 @@ ScrollInputHelper::ScrollInputHelper( ScrollInputHelper::~ScrollInputHelper() { UnhookScrollerPropertyChanged(); - UnhookScrollerChildPropertyChanged(); + UnhookScrollerContentPropertyChanged(); UnhookScrollViewerPropertyChanged(); UnhookScrollViewerContentPropertyChanged(); UnhookScrollViewerDirectManipulationStarted(); @@ -167,7 +167,7 @@ void ScrollInputHelper::SetScroller(const winrt::Scroller& scroller) HookScrollerPropertyChanged(); } - ProcessScrollerChildChange(); + ProcessScrollerContentChange(); } } @@ -237,7 +237,7 @@ void ScrollInputHelper::GetChildScrollerOrScrollViewer( } } -// Returns the ScrollViewer content as a UIElement, if any. Or Scroller.Child, if any. +// Returns the ScrollViewer content as a UIElement, if any. Or Scroller.Content, if any. winrt::UIElement ScrollInputHelper::GetScrollContentElement() const { if (m_scrollViewer) @@ -252,7 +252,7 @@ winrt::UIElement ScrollInputHelper::GetScrollContentElement() const } else if (auto scroller = m_scroller.get()) { - return scroller.Child(); + return scroller.Content(); } return nullptr; } @@ -959,7 +959,7 @@ void ScrollInputHelper::ProcessTargetElementChange() } } -// Invoked when the ScrollViewer.Content or Scroller.Child size changed. +// Invoked when the ScrollViewer.Content or Scroller.Content size changed. void ScrollInputHelper::ProcessContentSizeChange() { double oldContentWidth = GetContentSize(winrt::Orientation::Horizontal); @@ -1098,22 +1098,22 @@ void ScrollInputHelper::ProcessScrollViewerContentChange() OnSourceInfoChanged(true /*horizontalInfoChanged*/, true /*verticalInfoChanged*/, true /*zoomInfoChanged*/); } -void ScrollInputHelper::ProcessScrollerChildChange() +void ScrollInputHelper::ProcessScrollerContentChange() { auto scroller = m_scroller.get(); - UnhookScrollerChildPropertyChanged(); + UnhookScrollerContentPropertyChanged(); m_sourceContent.set(nullptr); if (scroller) { - winrt::UIElement newChild = scroller.Child(); + winrt::UIElement newContent = scroller.Content(); - if (newChild) + if (newContent) { - m_sourceContent.set(newChild.try_as()); + m_sourceContent.set(newContent.try_as()); - HookScrollerChildPropertyChanged(); + HookScrollerContentPropertyChanged(); } } @@ -1253,9 +1253,9 @@ void ScrollInputHelper::OnScrollViewerPropertyChanged(const winrt::DependencyObj // Invoked when a tracked dependency property changes for the Scroller dependency object. void ScrollInputHelper::OnScrollerPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args) { - if (args == winrt::Scroller::ChildProperty()) + if (args == winrt::Scroller::ContentProperty()) { - ProcessScrollerChildChange(); + ProcessScrollerContentChange(); } } @@ -1386,11 +1386,11 @@ void ScrollInputHelper::HookScrollerPropertyChanged() if (scroller) { - MUX_ASSERT(m_scrollerChildChangedToken.value == 0); + MUX_ASSERT(m_scrollerContentChangedToken.value == 0); MUX_ASSERT(m_sourceSizeChangedToken.value == 0); - m_scrollerChildChangedToken.value = scroller.RegisterPropertyChangedCallback( - winrt::Scroller::ChildProperty(), { this, &ScrollInputHelper::OnScrollerPropertyChanged }); + m_scrollerContentChangedToken.value = scroller.RegisterPropertyChangedCallback( + winrt::Scroller::ContentProperty(), { this, &ScrollInputHelper::OnScrollerPropertyChanged }); m_sourceSizeChangedToken = scroller.SizeChanged({ this, &ScrollInputHelper::OnSourceSizeChanged }); } } @@ -1434,10 +1434,10 @@ void ScrollInputHelper::UnhookScrollerPropertyChanged() if (scroller) { - if (m_scrollerChildChangedToken.value != 0) + if (m_scrollerContentChangedToken.value != 0) { - scroller.UnregisterPropertyChangedCallback(winrt::Scroller::ChildProperty(), m_scrollerChildChangedToken.value); - m_scrollerChildChangedToken.value = 0; + scroller.UnregisterPropertyChangedCallback(winrt::Scroller::ContentProperty(), m_scrollerContentChangedToken.value); + m_scrollerContentChangedToken.value = 0; } if (m_sourceSizeChangedToken.value != 0) { @@ -1469,7 +1469,7 @@ void ScrollInputHelper::HookScrollViewerContentPropertyChanged() } } -void ScrollInputHelper::HookScrollerChildPropertyChanged() +void ScrollInputHelper::HookScrollerContentPropertyChanged() { auto sourceContent = m_sourceContent.get(); @@ -1507,10 +1507,10 @@ void ScrollInputHelper::UnhookScrollViewerContentPropertyChanged() } // Note that if in the future the Scroller supports a virtual mode where the extent does not -// correspond to its Child size, the Scroller will need to raise an event when its virtual extent +// correspond to its Content size, the Scroller will need to raise an event when its virtual extent // changes so that the Scroller.ExpressionAnimationSources's Extent composition property can -// be read. This should replace hooking up the SizeChanged event on the Scroller.Child altogether. -void ScrollInputHelper::UnhookScrollerChildPropertyChanged() +// be read. This should replace hooking up the SizeChanged event on the Scroller.Content altogether. +void ScrollInputHelper::UnhookScrollerContentPropertyChanged() { auto sourceContent = m_sourceContent.safe_get(); diff --git a/dev/ParallaxView/ScrollInputHelper.h b/dev/ParallaxView/ScrollInputHelper.h index da4ad68c6f..1b1467a82e 100644 --- a/dev/ParallaxView/ScrollInputHelper.h +++ b/dev/ParallaxView/ScrollInputHelper.h @@ -63,7 +63,7 @@ class ScrollInputHelper void ProcessTargetElementChange(); void ProcessContentSizeChange(); void ProcessScrollViewerContentChange(); - void ProcessScrollerChildChange(); + void ProcessScrollerContentChange(); void ProcessScrollViewerZoomModeChange(); void OnSourceElementChanged(bool allowSourceElementLoadedHookup); @@ -92,8 +92,8 @@ class ScrollInputHelper void UnhookTargetElementLoaded(); void HookScrollerPropertyChanged(); void UnhookScrollerPropertyChanged(); - void HookScrollerChildPropertyChanged(); - void UnhookScrollerChildPropertyChanged(); + void HookScrollerContentPropertyChanged(); + void UnhookScrollerContentPropertyChanged(); void HookScrollViewerPropertyChanged(); void UnhookScrollViewerPropertyChanged(); void HookScrollViewerContentPropertyChanged(); @@ -141,7 +141,7 @@ class ScrollInputHelper winrt::event_token m_scrollViewerContentHorizontalAlignmentChangedToken{ 0 }; winrt::event_token m_scrollViewerContentVerticalAlignmentChangedToken{ 0 }; winrt::event_token m_scrollViewerContentChangedToken{ 0 }; - winrt::event_token m_scrollerChildChangedToken{ 0 }; + winrt::event_token m_scrollerContentChangedToken{ 0 }; winrt::event_token m_scrollViewerHorizontalContentAlignmentChangedToken{ 0 }; winrt::event_token m_scrollViewerVerticalContentAlignmentChangedToken{ 0 }; winrt::event_token m_scrollViewerZoomModeChangedToken{ 0 }; diff --git a/dev/ParallaxView/TestUI/DynamicPage.xaml.cs b/dev/ParallaxView/TestUI/DynamicPage.xaml.cs index 781944f530..26fed6201e 100644 --- a/dev/ParallaxView/TestUI/DynamicPage.xaml.cs +++ b/dev/ParallaxView/TestUI/DynamicPage.xaml.cs @@ -261,7 +261,7 @@ private void cmbVerticalContentAlignment_SelectionChanged(object sender, Selecti private void RefreshSourceContent() { if ( - (this.Scroller != null && this.Scroller.Child != null) || + (this.Scroller != null && this.Scroller.Content != null) || (this.ScrollViewer != null && this.ScrollViewer.Content != null)) { this.cmbSourceContent.SelectedIndex = 1; @@ -293,11 +293,11 @@ private void cmbSourceContent_SelectionChanged(object sender, SelectionChangedEv switch (this.cmbSourceContent.SelectedIndex) { case 0: - this.Scroller.Child = null; + this.Scroller.Content = null; break; case 1: if (this.Scroller == this.scroller) - this.Scroller.Child = this.rectSC; + this.Scroller.Content = this.rectSC; break; } } @@ -311,9 +311,9 @@ private void RefreshSVCAlignments() { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -331,9 +331,9 @@ private void cmbSCHorizontalAlignment_SelectionChanged(object sender, SelectionC { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -350,9 +350,9 @@ private void cmbSCVerticalAlignment_SelectionChanged(object sender, SelectionCha { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -375,9 +375,9 @@ private void btnGetSCWidth_Click(object sender, RoutedEventArgs e) { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -396,9 +396,9 @@ private void btnSetSCWidth_Click(object sender, RoutedEventArgs e) { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -419,9 +419,9 @@ private void btnGetSCHeight_Click(object sender, RoutedEventArgs e) { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -440,9 +440,9 @@ private void btnSetSCHeight_Click(object sender, RoutedEventArgs e) { feSourceContent = this.ScrollViewer.Content as FrameworkElement; } - else if (this.Scroller != null && this.Scroller.Child is FrameworkElement) + else if (this.Scroller != null && this.Scroller.Content is FrameworkElement) { - feSourceContent = this.Scroller.Child as FrameworkElement; + feSourceContent = this.Scroller.Content as FrameworkElement; } if (feSourceContent != null) @@ -1436,7 +1436,7 @@ private void SetupScroller() this.scroller.HorizontalScrollMode = ScrollMode.Disabled; this.scroller.VerticalScrollMode = ScrollMode.Enabled; this.scroller.ZoomMode = ZoomMode.Enabled; - this.scroller.Child = this.rectSC; + this.scroller.Content = this.rectSC; this.scroller.ViewChanged += Scroller_ViewChanged; this.scroller.SetValue(AutomationProperties.NameProperty, "scroller"); diff --git a/dev/ParallaxView/TestUI/SimpleRectanglePage.xaml.cs b/dev/ParallaxView/TestUI/SimpleRectanglePage.xaml.cs index 092bb6c820..2e2967983d 100644 --- a/dev/ParallaxView/TestUI/SimpleRectanglePage.xaml.cs +++ b/dev/ParallaxView/TestUI/SimpleRectanglePage.xaml.cs @@ -332,7 +332,7 @@ private void SetupScroller() s.Margin = new Thickness(4); s.HorizontalScrollMode = ScrollMode.Enabled; s.VerticalScrollMode = ScrollMode.Enabled; - s.Child = rectSC; + s.Content = rectSC; s.ViewChanged += Scroller_ViewChanged; sp.Children.Insert(0, s); diff --git a/dev/Repeater/APITests/EffectiveViewportScrollerTests.cs b/dev/Repeater/APITests/EffectiveViewportScrollerTests.cs index 5921c602ca..473df62851 100644 --- a/dev/Repeater/APITests/EffectiveViewportScrollerTests.cs +++ b/dev/Repeater/APITests/EffectiveViewportScrollerTests.cs @@ -79,7 +79,7 @@ public void ValidateOneScrollerScenario() scroller = new Scroller { - Child = repeater, + Content = repeater, Width = 200, Height = 300 }; @@ -150,7 +150,7 @@ public void ValidateTwoScrollersScenario() horizontalScroller = new Scroller { - Child = repeater, + Content = repeater, IsChildAvailableHeightConstrained = true }; @@ -161,7 +161,7 @@ public void ValidateTwoScrollersScenario() verticalScroller = new Scroller { - Child = grid, + Content = grid, Width = 200, Height = 200, IsChildAvailableWidthConstrained = true @@ -264,7 +264,7 @@ public void CanGrowCacheBuffer() Layout = layout }; - scroller.Child = repeater; + scroller.Content = repeater; Content = scroller; }); diff --git a/dev/Repeater/APITests/ViewportTests.cs b/dev/Repeater/APITests/ViewportTests.cs index b22c3fe527..4ea27f9c17 100644 --- a/dev/Repeater/APITests/ViewportTests.cs +++ b/dev/Repeater/APITests/ViewportTests.cs @@ -212,7 +212,7 @@ public void ValidateOneScrollerScenario() scroller = new Scroller { - Child = repeater, + Content = repeater, Width = 200, Height = 300 }; @@ -292,7 +292,7 @@ public void ValidateTwoScrollersScenario() horizontalScroller = new Scroller { - Child = repeater, + Content = repeater, IsChildAvailableHeightConstrained = true }; @@ -301,7 +301,7 @@ public void ValidateTwoScrollersScenario() verticalScroller = new Scroller { - Child = grid, + Content = grid, Width = 200, Height = 200, IsChildAvailableWidthConstrained = true @@ -394,7 +394,7 @@ public void ValidateSupportForScrollerConfigurationChanges() scrollers[i] = new Scroller() { - Child = grids[i], + Content = grids[i], IsChildAvailableWidthConstrained = true, IsChildAvailableHeightConstrained = true }; @@ -505,7 +505,7 @@ public void CanGrowCacheBuffer() Layout = layout }; - scroller.Child = repeater; + scroller.Content = repeater; Content = scroller; }); diff --git a/dev/ScrollViewer/APITests/ScrollViewerTests.cs b/dev/ScrollViewer/APITests/ScrollViewerTests.cs index 88b386237b..ce42db35c5 100644 --- a/dev/ScrollViewer/APITests/ScrollViewerTests.cs +++ b/dev/ScrollViewer/APITests/ScrollViewerTests.cs @@ -227,7 +227,7 @@ public void VerifyPropertyValuesAfterTemplateApplication() Log.Comment("Verifying ScrollViewer property values after Loaded event"); Verify.AreEqual(scrollViewer.Content, rectangleScrollViewerContent); Verify.IsNotNull(ScrollViewerTestHooks.GetScrollerPart(scrollViewer)); - Verify.AreEqual(ScrollViewerTestHooks.GetScrollerPart(scrollViewer).Child, rectangleScrollViewerContent); + Verify.AreEqual(ScrollViewerTestHooks.GetScrollerPart(scrollViewer).Content, rectangleScrollViewerContent); Verify.IsNotNull(scrollViewer.HorizontalScrollController); Verify.IsNotNull(scrollViewer.VerticalScrollController); diff --git a/dev/ScrollViewer/InteractionTests/ScrollViewerTestsWithInputHelper.cs b/dev/ScrollViewer/InteractionTests/ScrollViewerTestsWithInputHelper.cs index 06eca9b9f2..3311aee4a7 100644 --- a/dev/ScrollViewer/InteractionTests/ScrollViewerTestsWithInputHelper.cs +++ b/dev/ScrollViewer/InteractionTests/ScrollViewerTestsWithInputHelper.cs @@ -81,7 +81,7 @@ public void PanScrollViewer() if (PlatformConfiguration.IsOsVersion(OSVersion.Redstone1)) { - Log.Comment("On RS1 the Scroller's child is centered in an animated way when it's smaller than the viewport. Waiting for those animations to complete."); + Log.Comment("On RS1 the Scroller's content is centered in an animated way when it's smaller than the viewport. Waiting for those animations to complete."); WaitForScrollViewerManipulationEnd("scrollViewer21"); } @@ -120,7 +120,7 @@ public void PanScrollViewer() Verify.IsTrue(scroller51.HorizontalScrollPercent > minHorizontalScrollPercent, "Verifying scroller51 HorizontalScrollPercent is greater than " + minHorizontalScrollPercent + "%"); Verify.IsTrue(scroller51.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scroller51 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%"); - // scroller51's Child size is 800x800px. + // scroller51's Content size is 800x800px. double horizontalOffset; double verticalOffset; double minHorizontalOffset = 800.0 * (1.0 - scroller51.HorizontalViewSize / 100.0) * minHorizontalScrollPercent / 100.0; @@ -170,7 +170,7 @@ public void ScrollThenPanScrollViewer() if (PlatformConfiguration.IsOsVersion(OSVersion.Redstone1)) { - Log.Comment("On RS1 the Scroller's child is centered in an animated way when it's smaller than the viewport. Waiting for those animations to complete."); + Log.Comment("On RS1 the Scroller's content is centered in an animated way when it's smaller than the viewport. Waiting for those animations to complete."); WaitForScrollViewerManipulationEnd("scrollViewer21"); } @@ -234,7 +234,7 @@ public void ScrollThenPanScrollViewer() Verify.IsTrue(scroller51.VerticalScrollPercent > minVerticalScrollPercentAfterPan, "Verifying scroller51 VerticalScrollPercent is greater than " + minVerticalScrollPercentAfterPan + "%"); Verify.IsTrue(scroller51.VerticalScrollPercent > verticalScrollPercentAfterScroll, "Verifying scroller51 VerticalScrollPercent is greater than " + verticalScrollPercentAfterScroll + "%"); - // scroller51's Child size is 800x800px. + // scroller51's Content size is 800x800px. double horizontalOffset; double verticalOffset; double minHorizontalOffset = 800.0 * (1.0 - scroller51.HorizontalViewSize / 100.0) * minHorizontalScrollPercentAfterPan / 100.0; diff --git a/dev/ScrollViewer/ScrollViewer.cpp b/dev/ScrollViewer/ScrollViewer.cpp index 0e77298283..9423afeae8 100644 --- a/dev/ScrollViewer/ScrollViewer.cpp +++ b/dev/ScrollViewer/ScrollViewer.cpp @@ -1507,7 +1507,7 @@ winrt::DependencyObject ScrollViewer::GetNextFocusCandidate(winrt::FocusNavigati winrt::FocusNavigationDirection focusDirection = navigationDirection; winrt::FindNextElementOptions findNextElementOptions; - findNextElementOptions.SearchRoot(scroller.Child()); + findNextElementOptions.SearchRoot(scroller.Content()); if (isPageNavigation) { diff --git a/dev/ScrollViewer/ScrollViewer.xaml b/dev/ScrollViewer/ScrollViewer.xaml index 7ca093798b..c5e8e9fa29 100644 --- a/dev/ScrollViewer/ScrollViewer.xaml +++ b/dev/ScrollViewer/ScrollViewer.xaml @@ -208,7 +208,7 @@ { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); horizontalScrollController = new CompositionScrollController(); verticalScrollController = new CompositionScrollController(); @@ -116,7 +116,7 @@ public void ChangeOffsetsWhileScrollControllersAreAttached() SetupUIWithScrollControllers( scroller, - rectangleScrollerChild, + rectangleScrollerContent, horizontalScrollController, verticalScrollController, loadedEvent); @@ -135,26 +135,26 @@ public void ChangeOffsetsWhileScrollControllersAreAttached() Log.Comment("Jump to offsets"); ChangeOffsets( scroller, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 2.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 2.0, + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 2.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, true /*hookViewChanged*/, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 2.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 2.0); + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 2.0); Log.Comment("Animate to offsets"); ChangeOffsets( scroller, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 4.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 4.0, + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 4.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.AllowAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, false /*hookViewChanged*/, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 4.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 4.0); + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 4.0); Log.Comment("Jump to zoomFactor 2.0"); ChangeZoomFactor( @@ -188,7 +188,7 @@ public void ChangeOffsetsWithAttachedScrollControllers() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; CompositionScrollController horizontalScrollController = null; CompositionScrollController verticalScrollController = null; AutoResetEvent loadedEvent = new AutoResetEvent(false); @@ -198,7 +198,7 @@ public void ChangeOffsetsWithAttachedScrollControllers() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); horizontalScrollController = new CompositionScrollController(); verticalScrollController = new CompositionScrollController(); @@ -220,7 +220,7 @@ public void ChangeOffsetsWithAttachedScrollControllers() SetupUIWithScrollControllers( scroller, - rectangleScrollerChild, + rectangleScrollerContent, horizontalScrollController, verticalScrollController, loadedEvent); @@ -260,13 +260,13 @@ public void ChangeOffsetsWithAttachedScrollControllers() { Log.Comment("Jumping to horizontal offset"); hOffsetChangeId = horizontalScrollController.ChangeOffset( - (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); Log.Comment("Jumping to vertical offset"); vOffsetChangeId = verticalScrollController.ChangeOffset( - (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0, + (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); @@ -277,18 +277,18 @@ public void ChangeOffsetsWithAttachedScrollControllers() RunOnUIThread.Execute(() => { - Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0); - Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0); + Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0); + Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0); Log.Comment("Animating to horizontal offset"); hOffsetChangeId = horizontalScrollController.ChangeOffset( - (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.AllowAnimation); Log.Comment("Animating to vertical offset"); vOffsetChangeId = verticalScrollController.ChangeOffset( - (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0, + (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.AllowAnimation); @@ -301,8 +301,8 @@ public void ChangeOffsetsWithAttachedScrollControllers() RunOnUIThread.Execute(() => { - Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0); - Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0); + Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0); + Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0); }); } @@ -317,7 +317,7 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedScrollControllers() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; CompositionScrollController horizontalScrollController = null; CompositionScrollController verticalScrollController = null; AutoResetEvent loadedEvent = new AutoResetEvent(false); @@ -327,7 +327,7 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedScrollControllers() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); horizontalScrollController = new CompositionScrollController(); verticalScrollController = new CompositionScrollController(); @@ -349,7 +349,7 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedScrollControllers() SetupUIWithScrollControllers( scroller, - rectangleScrollerChild, + rectangleScrollerContent, horizontalScrollController, verticalScrollController, loadedEvent); @@ -462,13 +462,13 @@ public void ChangeOffsetsWhileBiDirectionalScrollControllerIsAttached() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; BiDirectionalScrollController biDirectionalScrollController = null; AutoResetEvent loadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); biDirectionalScrollController = new BiDirectionalScrollController(); @@ -482,7 +482,7 @@ public void ChangeOffsetsWhileBiDirectionalScrollControllerIsAttached() SetupUIWithBiDirectionalScrollController( scroller, - rectangleScrollerChild, + rectangleScrollerContent, biDirectionalScrollController, loadedEvent); }); @@ -499,26 +499,26 @@ public void ChangeOffsetsWhileBiDirectionalScrollControllerIsAttached() Log.Comment("Jump to offsets"); ChangeOffsets( scroller, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 2.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 2.0, + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 2.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, true /*hookViewChanged*/, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 2.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 2.0); + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 2.0); Log.Comment("Animate to offsets"); ChangeOffsets( scroller, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 4.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 4.0, + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 4.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.AllowAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, false /*hookViewChanged*/, - (c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth) / 4.0, - (c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight) / 4.0); + (c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight) / 4.0); Log.Comment("Jump to zoomFactor 2.0"); ChangeZoomFactor( @@ -552,14 +552,14 @@ public void ChangeOffsetsWithAttachedBiDirectionalScrollController() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; BiDirectionalScrollController biDirectionalScrollController = null; AutoResetEvent loadedEvent = new AutoResetEvent(false); AutoResetEvent viewChangeCompletedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); biDirectionalScrollController = new BiDirectionalScrollController(); @@ -573,7 +573,7 @@ public void ChangeOffsetsWithAttachedBiDirectionalScrollController() SetupUIWithBiDirectionalScrollController( scroller, - rectangleScrollerChild, + rectangleScrollerContent, biDirectionalScrollController, loadedEvent); @@ -607,8 +607,8 @@ public void ChangeOffsetsWithAttachedBiDirectionalScrollController() Log.Comment("Jumping to offsets"); biDirectionalScrollController.ChangeOffsets( new ScrollerChangeOffsetsOptions( - (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0, - (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0, + (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0, + (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints)); @@ -618,14 +618,14 @@ public void ChangeOffsetsWithAttachedBiDirectionalScrollController() RunOnUIThread.Execute(() => { - Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0); - Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0); + Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 4.0); + Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 4.0); Log.Comment("Animating to offsets"); biDirectionalScrollController.ChangeOffsets( new ScrollerChangeOffsetsOptions( - (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0, - (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0, + (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0, + (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.AllowAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints)); @@ -637,8 +637,8 @@ public void ChangeOffsetsWithAttachedBiDirectionalScrollController() RunOnUIThread.Execute(() => { - Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerChildWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0); - Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerChildHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0); + Verify.AreEqual(scroller.HorizontalOffset, (c_defaultUIScrollerContentWidth * 0.75 - c_defaultUIScrollerWidth) / 2.0); + Verify.AreEqual(scroller.VerticalOffset, (c_defaultUIScrollerContentHeight * 0.75 - c_defaultUIScrollerHeight) / 2.0); }); } @@ -653,14 +653,14 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedBiDirectionalScrollCon } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; BiDirectionalScrollController biDirectionalScrollController = null; AutoResetEvent loadedEvent = new AutoResetEvent(false); AutoResetEvent viewChangeCompletedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); biDirectionalScrollController = new BiDirectionalScrollController(); @@ -674,7 +674,7 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedBiDirectionalScrollCon SetupUIWithBiDirectionalScrollController( scroller, - rectangleScrollerChild, + rectangleScrollerContent, biDirectionalScrollController, loadedEvent); @@ -758,12 +758,12 @@ public void ChangeOffsetsWithAdditionalVelocityAndAttachedBiDirectionalScrollCon private void SetupUIWithScrollControllers( Scroller scroller, - Rectangle rectangleScrollerChild, + Rectangle rectangleScrollerContent, CompositionScrollController horizontalScrollController, CompositionScrollController verticalScrollController, AutoResetEvent loadedEvent) { - Log.Comment("Setting up UI with Scroller and scroll controlllers" + (rectangleScrollerChild == null ? "" : " and Rectangle")); + Log.Comment("Setting up UI with Scroller and scroll controlllers" + (rectangleScrollerContent == null ? "" : " and Rectangle")); LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) }; @@ -773,19 +773,19 @@ private void SetupUIWithScrollControllers( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { - rectangleScrollerChild.Width = c_defaultUIScrollerChildWidth; - rectangleScrollerChild.Height = c_defaultUIScrollerChildHeight; - rectangleScrollerChild.Fill = twoColorLGB; + rectangleScrollerContent.Width = c_defaultUIScrollerContentWidth; + rectangleScrollerContent.Height = c_defaultUIScrollerContentHeight; + rectangleScrollerContent.Fill = twoColorLGB; } Verify.IsNotNull(scroller); scroller.Width = c_defaultUIScrollerWidth; scroller.Height = c_defaultUIScrollerHeight; - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { - scroller.Child = rectangleScrollerChild; + scroller.Content = rectangleScrollerContent; } horizontalScrollController.Width = c_defaultUIScrollerWidth; @@ -816,11 +816,11 @@ private void SetupUIWithScrollControllers( private void SetupUIWithBiDirectionalScrollController( Scroller scroller, - Rectangle rectangleScrollerChild, + Rectangle rectangleScrollerContent, BiDirectionalScrollController biDirectionalScrollController, AutoResetEvent loadedEvent) { - Log.Comment("Setting up UI with Scroller and bi-directional scroll controller" + (rectangleScrollerChild == null ? "" : " and Rectangle")); + Log.Comment("Setting up UI with Scroller and bi-directional scroll controller" + (rectangleScrollerContent == null ? "" : " and Rectangle")); LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) }; @@ -830,19 +830,19 @@ private void SetupUIWithBiDirectionalScrollController( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { - rectangleScrollerChild.Width = c_defaultUIScrollerChildWidth; - rectangleScrollerChild.Height = c_defaultUIScrollerChildHeight; - rectangleScrollerChild.Fill = twoColorLGB; + rectangleScrollerContent.Width = c_defaultUIScrollerContentWidth; + rectangleScrollerContent.Height = c_defaultUIScrollerContentHeight; + rectangleScrollerContent.Fill = twoColorLGB; } Verify.IsNotNull(scroller); scroller.Width = c_defaultUIScrollerWidth; scroller.Height = c_defaultUIScrollerHeight; - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { - scroller.Child = rectangleScrollerChild; + scroller.Content = rectangleScrollerContent; } biDirectionalScrollController.Width = c_defaultUIScrollerHeight; diff --git a/dev/Scroller/APITests/ScrollerAnchoringTests.cs b/dev/Scroller/APITests/ScrollerAnchoringTests.cs index e2ef3c5f4e..82e17ad671 100644 --- a/dev/Scroller/APITests/ScrollerAnchoringTests.cs +++ b/dev/Scroller/APITests/ScrollerAnchoringTests.cs @@ -80,7 +80,7 @@ private void AnchoringAtNearEdge(Orientation orientation) RunOnUIThread.Execute(() => { Log.Comment("Inserting child at near edge"); - InsertStackPanelChild((scroller.Child as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/); + InsertStackPanelChild((scroller.Content as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/); }); IdleSynchronizer.Wait(); @@ -200,7 +200,7 @@ private void AnchoringAtFarEdgeWhileIncreasingContent(Orientation orientation, d }; Log.Comment("Inserting child at far edge"); - InsertStackPanelChild((scroller.Child as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/); + InsertStackPanelChild((scroller.Content as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/); if (viewportSizeChange != 0) { @@ -384,7 +384,7 @@ private void AnchoringAtAlmostNearEdge(Orientation orientation) }; Log.Comment("Inserting child at near edge"); - InsertStackPanelChild((scroller.Child as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/); + InsertStackPanelChild((scroller.Content as Border).Child as StackPanel, 1 /*operationCount*/, 0 /*newIndex*/, 1 /*newCount*/); }); WaitForEvent("Waiting for Scroller.ViewChanged event", scrollerViewChangedEvent); @@ -459,7 +459,7 @@ private void AnchoringAtAlmostFarEdge(Orientation orientation) RunOnUIThread.Execute(() => { Log.Comment("Inserting child at far edge"); - InsertStackPanelChild((scroller.Child as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/); + InsertStackPanelChild((scroller.Content as Border).Child as StackPanel, 1 /*operationCount*/, c_defaultAnchoringUIStackPanelChildrenCount /*newIndex*/, 1 /*newCount*/); }); IdleSynchronizer.Wait(); @@ -610,7 +610,7 @@ private void SetupDefaultAnchoringUI( scroller.Height = c_defaultAnchoringUIScrollerConstrainedSize; } scroller.Background = new SolidColorBrush(Colors.AliceBlue); - scroller.Child = border; + scroller.Content = border; InsertStackPanelChild(stackPanel, 0 /*operationCount*/, 0 /*newIndex*/, c_defaultAnchoringUIStackPanelChildrenCount /*newCount*/); @@ -630,7 +630,7 @@ private void SetupDefaultAnchoringUI( Verify.IsNull(args.AnchorElement); Verify.AreEqual(args.AnchorCandidates.Count, 0); - StackPanel sp = (sender.Child as Border).Child as StackPanel; + StackPanel sp = (sender.Content as Border).Child as StackPanel; foreach (Border b in sp.Children) { args.AnchorCandidates.Add(b); @@ -696,8 +696,8 @@ private void AnchoringWithOffsetCoercion(bool reduceAnchorOffset) AutoResetEvent scrollerViewChangedEvent = new AutoResetEvent(false); AutoResetEvent scrollerAnchorRequestedEvent = new AutoResetEvent(false); - // This test validates that the Scroller accounts for maximum vertical offset (based on viewport and child extent) - // when calculating the vertical offset shift for anchoring. The vertical offset cannot exceed child extent - viewport. + // This test validates that the Scroller accounts for maximum vertical offset (based on viewport and content extent) + // when calculating the vertical offset shift for anchoring. The vertical offset cannot exceed content extent - viewport. RunOnUIThread.Execute(() => { @@ -719,7 +719,7 @@ private void AnchoringWithOffsetCoercion(bool reduceAnchorOffset) scroller = new Scroller { - Child = grid, + Content = grid, Width = 200, Height = 200 }; @@ -761,11 +761,11 @@ private void AnchoringWithOffsetCoercion(bool reduceAnchorOffset) { Verify.AreEqual(600, scroller.VerticalOffset); - Log.Comment("Scroller.Child height is reduced by 300px. Scroller.VerticalOffset is expected to be reduced by 100px (600 -> 500)."); - (scroller.Child as Grid).Height = 700; + Log.Comment("Scroller.Content height is reduced by 300px. Scroller.VerticalOffset is expected to be reduced by 100px (600 -> 500)."); + (scroller.Content as Grid).Height = 700; if (reduceAnchorOffset) { - Log.Comment("Tracked element is shifted up by 200px within the Scroller.Child (600 -> 400). Anchoring is expected to reduce the VerticalOffset by half of that (500 -> 400)."); + Log.Comment("Tracked element is shifted up by 200px within the Scroller.Content (600 -> 400). Anchoring is expected to reduce the VerticalOffset by half of that (500 -> 400)."); anchorElement.Margin = new Thickness(0, 400, 0, 0); } scrollerViewChangedEvent.Reset(); @@ -814,7 +814,7 @@ public void AnchoringAtRepeaterMiddle() RunOnUIThread.Execute(() => { - repeater = (scroller.Child as Border).Child as ItemsRepeater; + repeater = (scroller.Content as Border).Child as ItemsRepeater; dataSource = repeater.ItemsSource as TestDataSource; scroller.ViewChanged += delegate (Scroller sender, object args) { @@ -905,7 +905,7 @@ private void SetupRepeaterAnchoringUI( scroller.Width = 400; scroller.Height = 600; scroller.Background = new SolidColorBrush(Colors.AliceBlue); - scroller.Child = border; + scroller.Content = border; if (scrollerLoadedEvent != null) { diff --git a/dev/Scroller/APITests/ScrollerBringIntoViewTests.cs b/dev/Scroller/APITests/ScrollerBringIntoViewTests.cs index e8329fa664..3086b8bc04 100644 --- a/dev/Scroller/APITests/ScrollerBringIntoViewTests.cs +++ b/dev/Scroller/APITests/ScrollerBringIntoViewTests.cs @@ -795,7 +795,7 @@ private void BringElementIntoView( } }; - UIElement targetElement = ((scroller.Child as Border).Child as StackPanel).Children[12]; + UIElement targetElement = ((scroller.Content as Border).Child as StackPanel).Children[12]; BringIntoViewOptions startingOptions = null; if (options == null) @@ -932,7 +932,7 @@ private void BringElementInNestedScrollersIntoView( outerBringIntoViewChangeId = args.ViewChangeId; }; - UIElement targetElement = ((innerScroller.Child as Border).Child as StackPanel).Children[12]; + UIElement targetElement = ((innerScroller.Content as Border).Child as StackPanel).Children[12]; if (options == null) { @@ -1082,7 +1082,7 @@ private void SetupDefaultBringIntoViewUI( scroller.Height = c_defaultBringIntoViewUIScrollerConstrainedSize; } scroller.Background = new SolidColorBrush(Colors.AliceBlue); - scroller.Child = border; + scroller.Content = border; InsertStackPanelChild(stackPanel, 0 /*operationCount*/, 0 /*newIndex*/, c_defaultBringIntoViewUIStackPanelChildrenCount /*newCount*/); @@ -1221,7 +1221,7 @@ private void SetupBringIntoViewUIWithScrollerInsideScroller( outerScroller.Height = c_defaultBringIntoViewUIScrollerConstrainedSize; } outerScroller.Background = new SolidColorBrush(Colors.AliceBlue); - outerScroller.Child = border; + outerScroller.Content = border; InsertStackPanelChild(stackPanel, 0 /*operationCount*/, 0 /*newIndex*/, c_defaultBringIntoViewUIStackPanelChildrenCount / 2 /*newCount*/, "outer" /*namePrefix*/); diff --git a/dev/Scroller/APITests/ScrollerLayoutTests.cs b/dev/Scroller/APITests/ScrollerLayoutTests.cs index f75d4217b8..49df022944 100644 --- a/dev/Scroller/APITests/ScrollerLayoutTests.cs +++ b/dev/Scroller/APITests/ScrollerLayoutTests.cs @@ -41,7 +41,7 @@ private enum BiDirectionalAlignment } [TestMethod] - [TestProperty("Description", "Sets Scroller.Child.Margin and verifies InteractionTracker.MaxPosition.")] + [TestProperty("Description", "Sets Scroller.Content.Margin and verifies InteractionTracker.MaxPosition.")] public void BasicMargin() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) @@ -52,60 +52,60 @@ public void BasicMargin() const double c_Margin = 50.0; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); RunOnUIThread.Execute(() => { - Log.Comment("Adding positive Margin to Scroller.Child"); - rectangleScrollerChild.Margin = new Thickness(c_Margin); + Log.Comment("Adding positive Margin to Scroller.Content"); + rectangleScrollerContent.Margin = new Thickness(c_Margin); }); // Try to jump beyond maximum offsets ChangeOffsets( scroller, - c_defaultUIScrollerChildWidth + 2 * c_Margin - c_defaultUIScrollerWidth + 10.0, - c_defaultUIScrollerChildHeight + 2 * c_Margin - c_defaultUIScrollerHeight + 10.0, + c_defaultUIScrollerContentWidth + 2 * c_Margin - c_defaultUIScrollerWidth + 10.0, + c_defaultUIScrollerContentHeight + 2 * c_Margin - c_defaultUIScrollerHeight + 10.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, true /*hookViewChanged*/, - c_defaultUIScrollerChildWidth + 2 * c_Margin - c_defaultUIScrollerWidth, - c_defaultUIScrollerChildHeight + 2 * c_Margin - c_defaultUIScrollerHeight); + c_defaultUIScrollerContentWidth + 2 * c_Margin - c_defaultUIScrollerWidth, + c_defaultUIScrollerContentHeight + 2 * c_Margin - c_defaultUIScrollerHeight); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { - Log.Comment("Adding negative Margin to Scroller.Child"); - rectangleScrollerChild.Margin = new Thickness(-c_Margin); + Log.Comment("Adding negative Margin to Scroller.Content"); + rectangleScrollerContent.Margin = new Thickness(-c_Margin); }); // Try to jump beyond maximum offsets ChangeOffsets( scroller, - c_defaultUIScrollerChildWidth - 2 * c_Margin - c_defaultUIScrollerWidth + 10.0, - c_defaultUIScrollerChildHeight - 2 * c_Margin - c_defaultUIScrollerHeight + 10.0, + c_defaultUIScrollerContentWidth - 2 * c_Margin - c_defaultUIScrollerWidth + 10.0, + c_defaultUIScrollerContentHeight - 2 * c_Margin - c_defaultUIScrollerHeight + 10.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, false /*hookViewChanged*/, - c_defaultUIScrollerChildWidth - 2 * c_Margin - c_defaultUIScrollerWidth, - c_defaultUIScrollerChildHeight - 2 * c_Margin - c_defaultUIScrollerHeight); + c_defaultUIScrollerContentWidth - 2 * c_Margin - c_defaultUIScrollerWidth, + c_defaultUIScrollerContentHeight - 2 * c_Margin - c_defaultUIScrollerHeight); } [TestMethod] - [TestProperty("Description", "Sets Scroller.Child.Padding and verifies InteractionTracker.MaxPosition.")] + [TestProperty("Description", "Sets Scroller.Content.Padding and verifies InteractionTracker.MaxPosition.")] public void BasicPadding() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) @@ -116,47 +116,47 @@ public void BasicPadding() const double c_Padding = 50.0; Scroller scroller = null; - Border borderScrollerChild = null; + Border borderScrollerContent = null; Rectangle rectangle = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - borderScrollerChild = new Border(); + borderScrollerContent = new Border(); rectangle = new Rectangle(); scroller = new Scroller(); - borderScrollerChild.Width = c_defaultUIScrollerChildWidth; - borderScrollerChild.Height = c_defaultUIScrollerChildHeight; - borderScrollerChild.Child = rectangle; - scroller.Child = borderScrollerChild; + borderScrollerContent.Width = c_defaultUIScrollerContentWidth; + borderScrollerContent.Height = c_defaultUIScrollerContentHeight; + borderScrollerContent.Child = rectangle; + scroller.Content = borderScrollerContent; - SetupDefaultUI(scroller, null /*rectangleScrollerChild*/, scrollerLoadedEvent); + SetupDefaultUI(scroller, null /*rectangleScrollerContent*/, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); RunOnUIThread.Execute(() => { - Log.Comment("Adding Padding to Scroller.Child"); - borderScrollerChild.Padding = new Thickness(c_Padding); + Log.Comment("Adding Padding to Scroller.Content"); + borderScrollerContent.Padding = new Thickness(c_Padding); }); // Try to jump beyond maximum offsets ChangeOffsets( scroller, - c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth + 10.0, - c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight + 10.0, + c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth + 10.0, + c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight + 10.0, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, ScrollerViewChangeSnapPointRespect.IgnoreSnapPoints, true /*hookViewChanged*/, - c_defaultUIScrollerChildWidth - c_defaultUIScrollerWidth, - c_defaultUIScrollerChildHeight - c_defaultUIScrollerHeight); + c_defaultUIScrollerContentWidth - c_defaultUIScrollerWidth, + c_defaultUIScrollerContentHeight - c_defaultUIScrollerHeight); } [TestMethod] - [TestProperty("Description", "Sets Scroller.Child.HorizontalAlignment/VerticalAlignment and verifies child positioning.")] + [TestProperty("Description", "Sets Scroller.Content.HorizontalAlignment/VerticalAlignment and verifies content positioning.")] public void BasicAlignment() { if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) @@ -173,7 +173,7 @@ public void BasicAlignment() const float c_smallZoomFactor = 0.15f; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); float horizontalOffset = 0.0f; float verticalOffset = 0.0f; @@ -182,36 +182,36 @@ public void BasicAlignment() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); compositor = Window.Current.Compositor; }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); - // Jump to absolute small zoomFactor to make the child smaller than the viewport. + // Jump to absolute small zoomFactor to make the content smaller than the viewport. ChangeZoomFactor(scroller, c_smallZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); RunOnUIThread.Execute(() => { Log.Comment("Covering Stretch/Strech alignments"); - Verify.AreEqual(rectangleScrollerChild.HorizontalAlignment, HorizontalAlignment.Stretch); - Verify.AreEqual(rectangleScrollerChild.VerticalAlignment, VerticalAlignment.Stretch); + Verify.AreEqual(rectangleScrollerContent.HorizontalAlignment, HorizontalAlignment.Stretch); + Verify.AreEqual(rectangleScrollerContent.VerticalAlignment, VerticalAlignment.Stretch); }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); - Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerChildWidth * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); - Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerChildHeight * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerContentWidth * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerContentHeight * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); Verify.AreEqual(zoomFactor, c_smallZoomFactor); RunOnUIThread.Execute(() => { Log.Comment("Covering Left/Top alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Left; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Top; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Left; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Top; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); @@ -223,32 +223,32 @@ public void BasicAlignment() RunOnUIThread.Execute(() => { Log.Comment("Covering Right/Bottom alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Right; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Bottom; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Right; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Bottom; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); - Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerChildWidth * c_smallZoomFactor)) < c_defaultOffsetResultTolerance); - Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerChildHeight * c_smallZoomFactor)) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerContentWidth * c_smallZoomFactor)) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerContentHeight * c_smallZoomFactor)) < c_defaultOffsetResultTolerance); Verify.AreEqual(zoomFactor, c_smallZoomFactor); RunOnUIThread.Execute(() => { Log.Comment("Covering Center/Center alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Center; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Center; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Center; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Center; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); - Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerChildWidth * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); - Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerChildHeight * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(horizontalOffset - (float)(c_defaultUIScrollerWidth - c_defaultUIScrollerContentWidth * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); + Verify.IsTrue(Math.Abs(verticalOffset - (float)(c_defaultUIScrollerHeight - c_defaultUIScrollerContentHeight * c_smallZoomFactor) / 2.0f) < c_defaultOffsetResultTolerance); Verify.AreEqual(zoomFactor, c_smallZoomFactor); } [TestMethod] - [TestProperty("Description", "Uses a StackPanel with Stretch alignment as Scroller.Child to verify it stretched to the size of the Scroller.")] + [TestProperty("Description", "Uses a StackPanel with Stretch alignment as Scroller.Content to verify it stretched to the size of the Scroller.")] public void StretchAlignment() { Scroller scroller = null; @@ -259,13 +259,13 @@ public void StretchAlignment() RunOnUIThread.Execute(() => { rectangle = new Rectangle(); - rectangle.Height = c_defaultUIScrollerChildHeight; + rectangle.Height = c_defaultUIScrollerContentHeight; stackPanel = new StackPanel(); stackPanel.Children.Add(rectangle); scroller = new Scroller(); scroller.Width = c_defaultUIScrollerWidth; scroller.Height = c_defaultUIScrollerHeight; - scroller.Child = stackPanel; + scroller.Content = stackPanel; scroller.Loaded += (object sender, RoutedEventArgs e) => { @@ -287,12 +287,12 @@ public void StretchAlignment() Log.Comment("Checking StackPanel size"); Verify.AreEqual(stackPanel.ActualWidth, c_defaultUIScrollerWidth); - Verify.AreEqual(stackPanel.ActualHeight, c_defaultUIScrollerChildHeight); + Verify.AreEqual(stackPanel.ActualHeight, c_defaultUIScrollerContentHeight); }); } [TestMethod] - [TestProperty("Description", "Sets Scroller.Child.HorizontalAlignment/VerticalAlignment and Scroller.Child.Margin and verifies child positioning.")] + [TestProperty("Description", "Sets Scroller.Content.HorizontalAlignment/VerticalAlignment and Scroller.Content.Margin and verifies content positioning.")] public void BasicMarginAndAlignment() { if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) @@ -310,7 +310,7 @@ public void BasicMarginAndAlignment() const float c_smallZoomFactor = 0.15f; const double c_Margin = 40.0; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); float horizontalOffset = 0.0f; float verticalOffset = 0.0f; @@ -319,26 +319,26 @@ public void BasicMarginAndAlignment() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); - Log.Comment("Adding positive Margin to Scroller.Child"); - rectangleScrollerChild.Margin = new Thickness(c_Margin); + Log.Comment("Adding positive Margin to Scroller.Content"); + rectangleScrollerContent.Margin = new Thickness(c_Margin); compositor = Window.Current.Compositor; }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); - // Jump to absolute small zoomFactor to make the child smaller than the viewport. + // Jump to absolute small zoomFactor to make the content smaller than the viewport. ChangeZoomFactor(scroller, c_smallZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); RunOnUIThread.Execute(() => { Log.Comment("Covering Stretch/Strech alignments"); - Verify.AreEqual(rectangleScrollerChild.HorizontalAlignment, HorizontalAlignment.Stretch); - Verify.AreEqual(rectangleScrollerChild.VerticalAlignment, VerticalAlignment.Stretch); + Verify.AreEqual(rectangleScrollerContent.HorizontalAlignment, HorizontalAlignment.Stretch); + Verify.AreEqual(rectangleScrollerContent.VerticalAlignment, VerticalAlignment.Stretch); }); @@ -351,8 +351,8 @@ public void BasicMarginAndAlignment() RunOnUIThread.Execute(() => { Log.Comment("Covering Left/Top alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Left; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Top; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Left; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Top; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); @@ -364,8 +364,8 @@ public void BasicMarginAndAlignment() RunOnUIThread.Execute(() => { Log.Comment("Covering Right/Bottom alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Right; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Bottom; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Right; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Bottom; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); @@ -377,8 +377,8 @@ public void BasicMarginAndAlignment() RunOnUIThread.Execute(() => { Log.Comment("Covering Center/Center alignments"); - rectangleScrollerChild.HorizontalAlignment = HorizontalAlignment.Center; - rectangleScrollerChild.VerticalAlignment = VerticalAlignment.Center; + rectangleScrollerContent.HorizontalAlignment = HorizontalAlignment.Center; + rectangleScrollerContent.VerticalAlignment = VerticalAlignment.Center; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); @@ -389,7 +389,7 @@ public void BasicMarginAndAlignment() } [TestMethod] - [TestProperty("Description", "Sets Scroller.Child to Image with unnatural size and verifies InteractionTracker.MaxPosition.")] + [TestProperty("Description", "Sets Scroller.Content to Image with unnatural size and verifies InteractionTracker.MaxPosition.")] public void ImageWithUnnaturalSize() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) @@ -401,22 +401,22 @@ public void ImageWithUnnaturalSize() const double c_UnnaturalImageWidth = 1200.0; const double c_UnnaturalImageHeight = 1000.0; Scroller scroller = null; - Image imageScrollerChild = null; + Image imageScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - imageScrollerChild = new Image(); + imageScrollerContent = new Image(); scroller = new Scroller(); Uri uri = new Uri("ms-appx:/Assets/ingredient3.png"); Verify.IsNotNull(uri); - imageScrollerChild.Source = new BitmapImage(uri); - imageScrollerChild.Width = c_UnnaturalImageWidth; - imageScrollerChild.Height = c_UnnaturalImageHeight; - scroller.Child = imageScrollerChild; + imageScrollerContent.Source = new BitmapImage(uri); + imageScrollerContent.Width = c_UnnaturalImageWidth; + imageScrollerContent.Height = c_UnnaturalImageHeight; + scroller.Content = imageScrollerContent; - SetupDefaultUI(scroller, null /*rectangleScrollerChild*/, scrollerLoadedEvent); + SetupDefaultUI(scroller, null /*rectangleScrollerContent*/, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -458,26 +458,26 @@ public void ImageWithConstrainedWidth() const double c_leftMargin = 20.0; const double c_rightMargin = 30.0; Scroller scroller = null; - Image imageScrollerChild = null; + Image imageScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); Compositor compositor = null; RunOnUIThread.Execute(() => { - imageScrollerChild = new Image(); + imageScrollerContent = new Image(); scroller = new Scroller(); Uri uri = new Uri("ms-appx:/Assets/ingredient3.png"); Verify.IsNotNull(uri); - imageScrollerChild.Source = new BitmapImage(uri); - imageScrollerChild.Margin = new Thickness(c_leftMargin, 0, c_rightMargin, 0); - scroller.Child = imageScrollerChild; + imageScrollerContent.Source = new BitmapImage(uri); + imageScrollerContent.Margin = new Thickness(c_leftMargin, 0, c_rightMargin, 0); + scroller.Content = imageScrollerContent; scroller.Background = new Media.SolidColorBrush(Colors.Chartreuse); - SetupDefaultUI(scroller, null /*rectangleScrollerChild*/, scrollerLoadedEvent); + SetupDefaultUI(scroller, null /*rectangleScrollerContent*/, scrollerLoadedEvent); // Constraining the Image width and making the Scroller smaller than the Image - imageScrollerChild.Height = c_imageHeight; + imageScrollerContent.Height = c_imageHeight; scroller.IsChildAvailableWidthConstrained = true; scroller.Width = c_scrollerWidth; compositor = Window.Current.Compositor; @@ -485,79 +485,79 @@ public void ImageWithConstrainedWidth() WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); - // Jump to absolute small zoomFactor to make the child smaller than the viewport. + // Jump to absolute small zoomFactor to make the content smaller than the viewport. ChangeZoomFactor(scroller, c_smallZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Stretch, expectedVerticalOffset: (float)(c_defaultUIScrollerHeight - c_imageHeight * c_smallZoomFactor) / 2.0f, // (200 - 300 * 0.5) / 2 = 25 expectedMinPosition: (float)(-c_scrollerWidth * c_smallZoomFactor / 2.0), // -50 expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Left, expectedVerticalOffset: (float)(c_defaultUIScrollerHeight - c_imageHeight * c_smallZoomFactor) / 2.0f, // (200 - 300 * 0.5) / 2 = 25 expectedMinPosition: 0.0f, expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Right, expectedVerticalOffset: (float)(c_defaultUIScrollerHeight - c_imageHeight * c_smallZoomFactor) / 2.0f, // (200 - 300 * 0.5) / 2 = 25 expectedMinPosition: (float)(-c_scrollerWidth * c_smallZoomFactor), // -100 expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Center, expectedVerticalOffset: (float)(c_defaultUIScrollerHeight - c_imageHeight * c_smallZoomFactor) / 2.0f, // (200 - 300 * 0.5) / 2 = 25 expectedMinPosition: (float)(-c_scrollerWidth * c_smallZoomFactor / 2.0), // -50 expectedZoomFactor: c_smallZoomFactor); - // Jump to absolute large zoomFactor to make the child larger than the viewport. + // Jump to absolute large zoomFactor to make the content larger than the viewport. ChangeZoomFactor(scroller, c_largeZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Stretch, expectedVerticalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Left, expectedVerticalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Right, expectedVerticalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedWidth( + ValidateContentWithConstrainedWidth( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, horizontalAlignment: HorizontalAlignment.Center, expectedVerticalOffset: 0.0f, expectedMinPosition: 0.0f, @@ -587,115 +587,115 @@ public void ImageWithConstrainedHeight() const double c_topMargin = 40.0; const double c_bottomMargin = 10.0; Scroller scroller = null; - Image imageScrollerChild = null; + Image imageScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); Compositor compositor = null; RunOnUIThread.Execute(() => { - imageScrollerChild = new Image(); + imageScrollerContent = new Image(); scroller = new Scroller(); Uri uri = new Uri("ms-appx:/Assets/ingredient3.png"); Verify.IsNotNull(uri); - imageScrollerChild.Source = new BitmapImage(uri); - imageScrollerChild.Margin = new Thickness(0, c_topMargin, 0, c_bottomMargin); - scroller.Child = imageScrollerChild; + imageScrollerContent.Source = new BitmapImage(uri); + imageScrollerContent.Margin = new Thickness(0, c_topMargin, 0, c_bottomMargin); + scroller.Content = imageScrollerContent; scroller.Background = new Media.SolidColorBrush(Colors.Chartreuse); - SetupDefaultUI(scroller, rectangleScrollerChild: null, scrollerLoadedEvent: scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent: null, scrollerLoadedEvent: scrollerLoadedEvent); // Constraining the Image height and making the Scroller smaller than the Image - imageScrollerChild.Width = c_imageWidth; + imageScrollerContent.Width = c_imageWidth; scroller.IsChildAvailableHeightConstrained = true; compositor = Window.Current.Compositor; }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); - // Jump to absolute small zoomFactor to make the child smaller than the viewport. + // Jump to absolute small zoomFactor to make the content smaller than the viewport. ChangeZoomFactor(scroller, c_smallZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Stretch, expectedHorizontalOffset: (float)(c_defaultUIScrollerWidth - c_imageWidth * c_smallZoomFactor) / 2.0f, // 87.5 expectedMinPosition: (float)(-c_defaultUIScrollerHeight * c_smallZoomFactor / 2.0), // -50 expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Top, expectedHorizontalOffset: (float)(c_defaultUIScrollerWidth - c_imageWidth * c_smallZoomFactor) / 2.0f, // 87.5 expectedMinPosition: 0.0f, expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Bottom, expectedHorizontalOffset: (float)(c_defaultUIScrollerWidth - c_imageWidth * c_smallZoomFactor) / 2.0f, // 87.5 expectedMinPosition: (float)(-c_defaultUIScrollerHeight * c_smallZoomFactor), // -100 expectedZoomFactor: c_smallZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Center, expectedHorizontalOffset: (float)(c_defaultUIScrollerWidth - c_imageWidth * c_smallZoomFactor) / 2.0f, // 87.5 expectedMinPosition: (float)(-c_defaultUIScrollerHeight * c_smallZoomFactor / 2.0), // -50 expectedZoomFactor: c_smallZoomFactor); - // Jump to absolute large zoomFactor to make the child larger than the viewport. + // Jump to absolute large zoomFactor to make the content larger than the viewport. ChangeZoomFactor(scroller, c_largeZoomFactor, 0.0f, 0.0f, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Stretch, expectedHorizontalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Top, expectedHorizontalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Bottom, expectedHorizontalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); - ValidateChildWithConstrainedHeight( + ValidateContentWithConstrainedHeight( compositor, scroller, - child: imageScrollerChild, + content: imageScrollerContent, verticalAlignment: VerticalAlignment.Center, expectedHorizontalOffset: 0.0f, expectedMinPosition: 0.0f, expectedZoomFactor: c_largeZoomFactor); } - private void ValidateChildWithConstrainedWidth( + private void ValidateContentWithConstrainedWidth( Compositor compositor, Scroller scroller, - FrameworkElement child, + FrameworkElement content, HorizontalAlignment horizontalAlignment, float expectedVerticalOffset, float expectedMinPosition, @@ -714,16 +714,16 @@ private void ValidateChildWithConstrainedWidth( RunOnUIThread.Execute(() => { Log.Comment("Covering alignment " + horizontalAlignment.ToString()); - child.HorizontalAlignment = horizontalAlignment; + content.HorizontalAlignment = horizontalAlignment; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { - Verify.AreEqual(child.HorizontalAlignment, horizontalAlignment); - Verify.AreEqual(child.DesiredSize.Width, c_scrollerWidth); // 200 - Verify.AreEqual(child.RenderSize.Width, c_scrollerWidth - c_leftMargin - c_rightMargin); // 200 - 20 - 30 = 150 + Verify.AreEqual(content.HorizontalAlignment, horizontalAlignment); + Verify.AreEqual(content.DesiredSize.Width, c_scrollerWidth); // 200 + Verify.AreEqual(content.RenderSize.Width, c_scrollerWidth - c_leftMargin - c_rightMargin); // 200 - 20 - 30 = 150 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta( BiDirectionalAlignmentFromHorizontalAlignment(horizontalAlignment), extentSize: c_scrollerWidth, @@ -745,10 +745,10 @@ private void ValidateChildWithConstrainedWidth( Verify.AreEqual(zoomFactor, expectedZoomFactor); } - private void ValidateChildWithConstrainedHeight( + private void ValidateContentWithConstrainedHeight( Compositor compositor, Scroller scroller, - FrameworkElement child, + FrameworkElement content, VerticalAlignment verticalAlignment, float expectedHorizontalOffset, float expectedMinPosition, @@ -766,16 +766,16 @@ private void ValidateChildWithConstrainedHeight( RunOnUIThread.Execute(() => { Log.Comment("Covering alignment " + verticalAlignment.ToString()); - child.VerticalAlignment = verticalAlignment; + content.VerticalAlignment = verticalAlignment; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { - Verify.AreEqual(child.VerticalAlignment, verticalAlignment); - Verify.AreEqual(child.DesiredSize.Height, c_defaultUIScrollerHeight); // 200 - Verify.AreEqual(child.RenderSize.Height, c_defaultUIScrollerHeight - c_topMargin - c_bottomMargin); // 200 - 40 - 10 = 150 + Verify.AreEqual(content.VerticalAlignment, verticalAlignment); + Verify.AreEqual(content.DesiredSize.Height, c_defaultUIScrollerHeight); // 200 + Verify.AreEqual(content.RenderSize.Height, c_defaultUIScrollerHeight - c_topMargin - c_bottomMargin); // 200 - 40 - 10 = 150 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta( BiDirectionalAlignmentFromVerticalAlignment(verticalAlignment), extentSize: c_defaultUIScrollerHeight, diff --git a/dev/Scroller/APITests/ScrollerTests.cs b/dev/Scroller/APITests/ScrollerTests.cs index 5fc66fb2bb..c327144160 100644 --- a/dev/Scroller/APITests/ScrollerTests.cs +++ b/dev/Scroller/APITests/ScrollerTests.cs @@ -72,8 +72,8 @@ public partial class ScrollerTests private const double c_defaultVerticalOffset = 0.0; private const double c_defaultAnchorRatio = 0.0; - private const double c_defaultUIScrollerChildWidth = 1200.0; - private const double c_defaultUIScrollerChildHeight = 600.0; + private const double c_defaultUIScrollerContentWidth = 1200.0; + private const double c_defaultUIScrollerContentHeight = 600.0; private const double c_defaultUIScrollerWidth = 300.0; private const double c_defaultUIScrollerHeight = 200.0; private const double c_defaultUIScrollControllerThickness = 44.0; @@ -104,7 +104,7 @@ public void VerifyDefaultPropertyValues() Log.Comment("Verifying Scroller default property values"); Verify.IsNull(scroller.HorizontalScrollController); Verify.IsNull(scroller.VerticalScrollController); - Verify.IsNull(scroller.Child); + Verify.IsNull(scroller.Content); Verify.IsNotNull(scroller.ExpressionAnimationSources); Verify.AreEqual(scroller.State, c_defaultState); Verify.AreEqual(scroller.HorizontalScrollChainingMode, c_defaultHorizontalScrollChainingMode); @@ -146,7 +146,7 @@ public void VerifyPropertyGettersAndSetters() Verify.IsNotNull(rectangle); Log.Comment("Setting Scroller properties to non-default values"); - scroller.Child = rectangle; + scroller.Content = rectangle; scroller.HorizontalScrollChainingMode = ChainingMode.Always; scroller.VerticalScrollChainingMode = ChainingMode.Never; scroller.HorizontalScrollRailingMode = RailingMode.Disabled; @@ -171,7 +171,7 @@ public void VerifyPropertyGettersAndSetters() RunOnUIThread.Execute(() => { Log.Comment("Verifying Scroller non-default property values"); - Verify.AreEqual(scroller.Child, rectangle); + Verify.AreEqual(scroller.Content, rectangle); Verify.AreEqual(scroller.State, c_defaultState); Verify.AreEqual(scroller.HorizontalScrollChainingMode, ChainingMode.Always); Verify.AreEqual(scroller.VerticalScrollChainingMode, ChainingMode.Never); @@ -286,15 +286,15 @@ public void VerifyInteractionSourceSettings() using (ScrollerTestHooksHelper scrollerTestHooksHelper = new ScrollerTestHooksHelper(enableAnchorNotifications: false, enableInteractionSourcesNotifications: true)) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -372,8 +372,8 @@ public void VerifyInteractionSourceSettings() } [TestMethod] - [TestProperty("Description", "Decreases the Scroller.MaxZoomFactor property and verifies the Scroller.ZoomFactor value decreases accordingly. Verifies the impact on the Scroller.Child Visual.")] - public void PinchChildThroughMaxZoomFactor() + [TestProperty("Description", "Decreases the Scroller.MaxZoomFactor property and verifies the Scroller.ZoomFactor value decreases accordingly. Verifies the impact on the Scroller.Content Visual.")] + public void PinchContentThroughMaxZoomFactor() { if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) { @@ -389,18 +389,18 @@ public void PinchChildThroughMaxZoomFactor() const double newMaxZoomFactor = 0.5; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; - Visual visualScrollerChild = null; + Rectangle rectangleScrollerContent = null; + Visual visualScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); Compositor compositor = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); SetupDefaultUI( - scroller, rectangleScrollerChild, scrollerLoadedEvent); + scroller, rectangleScrollerContent, scrollerLoadedEvent); compositor = Window.Current.Compositor; }); @@ -422,8 +422,8 @@ public void PinchChildThroughMaxZoomFactor() { Log.Comment("Setting up spy on translation and scale facades"); - CompositionPropertySpy.StartSpyingTranslationFacade(rectangleScrollerChild, compositor, Vector3.Zero); - CompositionPropertySpy.StartSpyingScaleFacade(rectangleScrollerChild, compositor, Vector3.One); + CompositionPropertySpy.StartSpyingTranslationFacade(rectangleScrollerContent, compositor, Vector3.Zero); + CompositionPropertySpy.StartSpyingScaleFacade(rectangleScrollerContent, compositor, Vector3.One); }); } else @@ -431,11 +431,11 @@ public void PinchChildThroughMaxZoomFactor() RunOnUIThread.Execute(() => { Log.Comment("Setting up spy property set"); - visualScrollerChild = ElementCompositionPreview.GetElementVisual(rectangleScrollerChild); + visualScrollerContent = ElementCompositionPreview.GetElementVisual(rectangleScrollerContent); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -447,8 +447,8 @@ public void PinchChildThroughMaxZoomFactor() { RunOnUIThread.Execute(() => { - CompositionPropertySpy.StopSpyingTranslationFacade(rectangleScrollerChild); - CompositionPropertySpy.StopSpyingScaleFacade(rectangleScrollerChild); + CompositionPropertySpy.StopSpyingTranslationFacade(rectangleScrollerContent); + CompositionPropertySpy.StopSpyingScaleFacade(rectangleScrollerContent); }); } else @@ -456,9 +456,9 @@ public void PinchChildThroughMaxZoomFactor() RunOnUIThread.Execute(() => { Log.Comment("Cancelling spying"); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -472,7 +472,7 @@ public void PinchChildThroughMaxZoomFactor() Verify.AreEqual(scroller.MaxZoomFactor, newMaxZoomFactor); }); - Log.Comment("Validating final transform of Scroller.Child's Visual after MaxZoomFactor change"); + Log.Comment("Validating final transform of Scroller.Content's Visual after MaxZoomFactor change"); CompositionGetValueStatus status; float offset; float zoomFactor; @@ -482,14 +482,14 @@ public void PinchChildThroughMaxZoomFactor() RunOnUIThread.Execute(() => { Vector3 translation; - status = CompositionPropertySpy.TryGetTranslationFacade(rectangleScrollerChild, out translation); + status = CompositionPropertySpy.TryGetTranslationFacade(rectangleScrollerContent, out translation); Log.Comment("status={0}, horizontal offset={1}", status, translation.X); Log.Comment("status={0}, vertical offset={1}", status, translation.Y); Verify.AreEqual(translation.X, c_defaultHorizontalOffset); Verify.AreEqual(translation.Y, c_defaultVerticalOffset); Vector3 scale; - status = CompositionPropertySpy.TryGetScaleFacade(rectangleScrollerChild, out scale); + status = CompositionPropertySpy.TryGetScaleFacade(rectangleScrollerContent, out scale); Log.Comment("status={0}, vertical offset={1}", status, scale.X); Verify.AreEqual(scale.X, newMaxZoomFactor); }); @@ -498,15 +498,15 @@ public void PinchChildThroughMaxZoomFactor() { RunOnUIThread.Execute(() => { - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName, out offset); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName, out offset); Log.Comment("status={0}, horizontal offset={1}", status, offset); Verify.AreEqual(offset, c_defaultHorizontalOffset); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName, out offset); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName, out offset); Log.Comment("status={0}, vertical offset={1}", status, offset); Verify.AreEqual(offset, c_defaultVerticalOffset); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualScaleTargetedPropertyName, out zoomFactor); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualScaleTargetedPropertyName, out zoomFactor); Log.Comment("status={0}, zoomFactor={1}", status, zoomFactor); Verify.AreEqual(zoomFactor, newMaxZoomFactor); }); @@ -514,8 +514,8 @@ public void PinchChildThroughMaxZoomFactor() } [TestMethod] - [TestProperty("Description", "Increases the Scroller.MinZoomFactor property and verifies the Scroller.ZoomFactor value increases accordingly. Verifies the impact on the Scroller.Child Visual.")] - public void StretchChildThroughMinZoomFactor() + [TestProperty("Description", "Increases the Scroller.MinZoomFactor property and verifies the Scroller.ZoomFactor value increases accordingly. Verifies the impact on the Scroller.Content Visual.")] + public void StretchContentThroughMinZoomFactor() { if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) { @@ -531,18 +531,18 @@ public void StretchChildThroughMinZoomFactor() const double newMinZoomFactor = 2.0; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; - Visual visualScrollerChild = null; + Rectangle rectangleScrollerContent = null; + Visual visualScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); Compositor compositor = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); SetupDefaultUI( - scroller, rectangleScrollerChild, scrollerLoadedEvent); + scroller, rectangleScrollerContent, scrollerLoadedEvent); compositor = Window.Current.Compositor; }); @@ -564,8 +564,8 @@ public void StretchChildThroughMinZoomFactor() { Log.Comment("Setting up spy on translation and scale facades"); - CompositionPropertySpy.StartSpyingTranslationFacade(rectangleScrollerChild, compositor, Vector3.Zero); - CompositionPropertySpy.StartSpyingScaleFacade(rectangleScrollerChild, compositor, Vector3.One); + CompositionPropertySpy.StartSpyingTranslationFacade(rectangleScrollerContent, compositor, Vector3.Zero); + CompositionPropertySpy.StartSpyingScaleFacade(rectangleScrollerContent, compositor, Vector3.One); }); } else @@ -573,11 +573,11 @@ public void StretchChildThroughMinZoomFactor() RunOnUIThread.Execute(() => { Log.Comment("Setting up spy property set"); - visualScrollerChild = ElementCompositionPreview.GetElementVisual(rectangleScrollerChild); + visualScrollerContent = ElementCompositionPreview.GetElementVisual(rectangleScrollerContent); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -589,17 +589,17 @@ public void StretchChildThroughMinZoomFactor() { RunOnUIThread.Execute(() => { - CompositionPropertySpy.StopSpyingTranslationFacade(rectangleScrollerChild); - CompositionPropertySpy.StopSpyingScaleFacade(rectangleScrollerChild); + CompositionPropertySpy.StopSpyingTranslationFacade(rectangleScrollerContent); + CompositionPropertySpy.StopSpyingScaleFacade(rectangleScrollerContent); }); } else { RunOnUIThread.Execute(() => { - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -613,7 +613,7 @@ public void StretchChildThroughMinZoomFactor() Verify.AreEqual(scroller.MaxZoomFactor, c_defaultMaxZoomFactor); }); - Log.Comment("Validating final transform of Scroller.Child's Visual after MinZoomFactor change"); + Log.Comment("Validating final transform of Scroller.Content's Visual after MinZoomFactor change"); CompositionGetValueStatus status; float offset; float zoomFactor; @@ -623,14 +623,14 @@ public void StretchChildThroughMinZoomFactor() RunOnUIThread.Execute(() => { Vector3 translation; - status = CompositionPropertySpy.TryGetTranslationFacade(rectangleScrollerChild, out translation); + status = CompositionPropertySpy.TryGetTranslationFacade(rectangleScrollerContent, out translation); Log.Comment("status={0}, horizontal offset={1}", status, translation.X); Log.Comment("status={0}, vertical offset={1}", status, translation.Y); Verify.AreEqual(translation.X, c_defaultHorizontalOffset); Verify.AreEqual(translation.Y, c_defaultVerticalOffset); Vector3 scale; - status = CompositionPropertySpy.TryGetScaleFacade(rectangleScrollerChild, out scale); + status = CompositionPropertySpy.TryGetScaleFacade(rectangleScrollerContent, out scale); Log.Comment("status={0}, vertical offset={1}", status, scale.X); Verify.AreEqual(scale.X, newMinZoomFactor); }); @@ -639,15 +639,15 @@ public void StretchChildThroughMinZoomFactor() { RunOnUIThread.Execute(() => { - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName, out offset); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName, out offset); Log.Comment("status={0}, horizontal offset={1}", status, offset); Verify.AreEqual(offset, c_defaultHorizontalOffset); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName, out offset); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName, out offset); Log.Comment("status={0}, vertical offset={1}", status, offset); Verify.AreEqual(offset, c_defaultVerticalOffset); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualScaleTargetedPropertyName, out zoomFactor); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualScaleTargetedPropertyName, out zoomFactor); Log.Comment("status={0}, zoomFactor={1}", status, zoomFactor); Verify.AreEqual(zoomFactor, newMinZoomFactor); }); @@ -659,16 +659,16 @@ public void StretchChildThroughMinZoomFactor() public void ReadExpressionAnimationSources() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); SetupDefaultUI( - scroller, rectangleScrollerChild, scrollerLoadedEvent); + scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -746,8 +746,8 @@ public void ReadExpressionAnimationSources() Log.Comment("Validating final extent"); status = scroller.ExpressionAnimationSources.TryGetVector2(c_expressionAnimationSourcesExtentPropertyName, out extent); Log.Comment("status={0}, extent={1}", status, extent); - Verify.AreEqual(extent.X, c_defaultUIScrollerChildWidth); - Verify.AreEqual(extent.Y, c_defaultUIScrollerChildHeight); + Verify.AreEqual(extent.X, c_defaultUIScrollerContentWidth); + Verify.AreEqual(extent.Y, c_defaultUIScrollerContentHeight); Log.Comment("Validating final viewport"); status = scroller.ExpressionAnimationSources.TryGetVector2(c_expressionAnimationSourcesViewportPropertyName, out viewport); @@ -813,8 +813,8 @@ public void ValidateXYFocusNavigation() } [TestMethod] - [TestProperty("Description", "Listens to the Scroller.Child.EffectiveViewportChanged event and expects it to be raised while changing offsets.")] - public void ListenToChildEffectiveViewportChanged() + [TestProperty("Description", "Listens to the Scroller.Content.EffectiveViewportChanged event and expects it to be raised while changing offsets.")] + public void ListenToContentEffectiveViewportChanged() { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { @@ -823,20 +823,20 @@ public void ListenToChildEffectiveViewportChanged() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); int effectiveViewportChangedCount = 0; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); - rectangleScrollerChild.EffectiveViewportChanged += (FrameworkElement sender, EffectiveViewportChangedEventArgs args) => + rectangleScrollerContent.EffectiveViewportChanged += (FrameworkElement sender, EffectiveViewportChangedEventArgs args) => { - Log.Comment("Scroller.Child.EffectiveViewportChanged: BringIntoViewDistance=" + + Log.Comment("Scroller.Content.EffectiveViewportChanged: BringIntoViewDistance=" + args.BringIntoViewDistanceX + "," + args.BringIntoViewDistanceY + ", EffectiveViewport=" + args.EffectiveViewport.ToString() + ", MaxViewport=" + args.MaxViewport.ToString()); effectiveViewportChangedCount++; @@ -863,13 +863,13 @@ public void ListenToChildEffectiveViewportChanged() private void SetupDefaultUI( Scroller scroller, - Rectangle rectangleScrollerChild, + Rectangle rectangleScrollerContent, AutoResetEvent scrollerLoadedEvent, bool setAsContentRoot = true) { - Log.Comment("Setting up default UI with Scroller" + (rectangleScrollerChild == null ? "" : " and Rectangle")); + Log.Comment("Setting up default UI with Scroller" + (rectangleScrollerContent == null ? "" : " and Rectangle")); - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { LinearGradientBrush twoColorLGB = new LinearGradientBrush() { StartPoint = new Point(0, 0), EndPoint = new Point(1, 1) }; @@ -879,17 +879,17 @@ private void SetupDefaultUI( GradientStop orangeGS = new GradientStop() { Color = Colors.Orange, Offset = 1.0 }; twoColorLGB.GradientStops.Add(orangeGS); - rectangleScrollerChild.Width = c_defaultUIScrollerChildWidth; - rectangleScrollerChild.Height = c_defaultUIScrollerChildHeight; - rectangleScrollerChild.Fill = twoColorLGB; + rectangleScrollerContent.Width = c_defaultUIScrollerContentWidth; + rectangleScrollerContent.Height = c_defaultUIScrollerContentHeight; + rectangleScrollerContent.Fill = twoColorLGB; } Verify.IsNotNull(scroller); scroller.Width = c_defaultUIScrollerWidth; scroller.Height = c_defaultUIScrollerHeight; - if (rectangleScrollerChild != null) + if (rectangleScrollerContent != null) { - scroller.Child = rectangleScrollerChild; + scroller.Content = rectangleScrollerContent; } if (scrollerLoadedEvent != null) @@ -919,19 +919,19 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou horizontalOffset = verticalOffset = 0.0f; zoomFactor = 0.0f; - Visual visualScrollerChild = null; + Visual visualScrollerContent = null; if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) { RunOnUIThread.Execute(() => { Verify.IsNotNull(scroller); - Verify.IsNotNull(scroller.Child); + Verify.IsNotNull(scroller.Content); Log.Comment("Setting up spying on facades"); - CompositionPropertySpy.StartSpyingTranslationFacade(scroller.Child, compositor, Vector3.Zero); - CompositionPropertySpy.StartSpyingScaleFacade(scroller.Child, compositor, Vector3.One); + CompositionPropertySpy.StartSpyingTranslationFacade(scroller.Content, compositor, Vector3.Zero); + CompositionPropertySpy.StartSpyingScaleFacade(scroller.Content, compositor, Vector3.One); }); } else @@ -939,13 +939,13 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou RunOnUIThread.Execute(() => { Verify.IsNotNull(scroller); - Verify.IsNotNull(scroller.Child); + Verify.IsNotNull(scroller.Content); Log.Comment("Setting up spy property set"); - visualScrollerChild = ElementCompositionPreview.GetElementVisual(scroller.Child); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + visualScrollerContent = ElementCompositionPreview.GetElementVisual(scroller.Content); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StartSpyingScalarProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -957,17 +957,17 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou { RunOnUIThread.Execute(() => { - CompositionPropertySpy.StopSpyingTranslationFacade(scroller.Child); - CompositionPropertySpy.StopSpyingScaleFacade(scroller.Child); + CompositionPropertySpy.StopSpyingTranslationFacade(scroller.Content); + CompositionPropertySpy.StopSpyingScaleFacade(scroller.Content); }); } else { RunOnUIThread.Execute(() => { - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName); - CompositionPropertySpy.StopSpyingProperty(visualScrollerChild, c_visualScaleTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName); + CompositionPropertySpy.StopSpyingProperty(visualScrollerContent, c_visualScaleTargetedPropertyName); }); } @@ -975,7 +975,7 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou CompositionPropertySpy.SynchronouslyTickUIThread(10); - Log.Comment("Reading Scroller.Child's Visual Transform"); + Log.Comment("Reading Scroller.Content's Visual Transform"); CompositionGetValueStatus status; if (PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4)) @@ -983,14 +983,14 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou RunOnUIThread.Execute(() => { Vector3 translation = Vector3.Zero; - status = CompositionPropertySpy.TryGetTranslationFacade(scroller.Child, out translation); + status = CompositionPropertySpy.TryGetTranslationFacade(scroller.Content, out translation); Log.Comment("status={0}, horizontal offset={1}", status, translation.X); Log.Comment("status={0}, vertical offset={1}", status, translation.Y); horizontalOffsetTmp = translation.X; verticalOffsetTmp = translation.Y; Vector3 scale = Vector3.One; - status = CompositionPropertySpy.TryGetScaleFacade(scroller.Child, out scale); + status = CompositionPropertySpy.TryGetScaleFacade(scroller.Content, out scale); Log.Comment("status={0}, zoomFactor={1}", status, zoomFactorTmp); zoomFactorTmp = scale.X; }); @@ -999,13 +999,13 @@ private void SpyTranslationAndScale(Scroller scroller, Compositor compositor, ou { RunOnUIThread.Execute(() => { - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualHorizontalOffsetTargetedPropertyName, out horizontalOffsetTmp); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualHorizontalOffsetTargetedPropertyName, out horizontalOffsetTmp); Log.Comment("status={0}, horizontal offset={1}", status, horizontalOffsetTmp); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualVerticalOffsetTargetedPropertyName, out verticalOffsetTmp); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualVerticalOffsetTargetedPropertyName, out verticalOffsetTmp); Log.Comment("status={0}, vertical offset={1}", status, verticalOffsetTmp); - status = CompositionPropertySpy.TryGetScalar(visualScrollerChild, c_visualScaleTargetedPropertyName, out zoomFactorTmp); + status = CompositionPropertySpy.TryGetScalar(visualScrollerContent, c_visualScaleTargetedPropertyName, out zoomFactorTmp); Log.Comment("status={0}, zoomFactor={1}", status, zoomFactorTmp); }); } diff --git a/dev/Scroller/APITests/ScrollerViewChangeTests.cs b/dev/Scroller/APITests/ScrollerViewChangeTests.cs index 287169a059..9fa1dc11f3 100644 --- a/dev/Scroller/APITests/ScrollerViewChangeTests.cs +++ b/dev/Scroller/APITests/ScrollerViewChangeTests.cs @@ -69,15 +69,15 @@ public void TestCleanup() public void BasicOffsetChanges() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -113,15 +113,15 @@ public void BasicOffsetChanges() public void BasicZoomFactorChanges() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -150,17 +150,17 @@ public void BasicZoomFactorChanges() public void BasicOffsetsChangeCancelation() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -219,18 +219,18 @@ public void BasicZoomFactorChangeCancelation() using (PrivateLoggingHelper privateLoggingHelper = new PrivateLoggingHelper("Scroller")) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); scroller.Name = "scr"; - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -288,7 +288,7 @@ public void ValidateChangingOffsetsAndZoomFactorEventArgsHaveValidStartAndEndPos int numOffsetChanges = 0; int numZoomFactorChanges = 0; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); Point newPosition1 = new Point(100, 150); Point newPosition2 = new Point(50, 100); @@ -297,11 +297,11 @@ public void ValidateChangingOffsetsAndZoomFactorEventArgsHaveValidStartAndEndPos RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); SetupDefaultUI( - scroller, rectangleScrollerChild, scrollerLoadedEvent); + scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -377,7 +377,7 @@ public void OffsetsChangeWithCustomDuration() using (PrivateLoggingHelper privateLoggingHelper = new PrivateLoggingHelper("Scroller")) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; @@ -385,10 +385,10 @@ public void OffsetsChangeWithCustomDuration() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -455,7 +455,7 @@ public void ZoomFactorChangeWithCustomDuration() using (PrivateLoggingHelper privateLoggingHelper = new PrivateLoggingHelper("Scroller")) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; @@ -463,10 +463,10 @@ public void ZoomFactorChangeWithCustomDuration() RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -524,17 +524,17 @@ public void ZoomFactorChangeWithCustomDuration() public void InterruptViewChangeWithUnloading() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent, setAsContentRoot: true); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent, setAsContentRoot: true); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -603,8 +603,8 @@ public void InterruptZoomFactorChangeWithZoomFactorChange() } [TestMethod] - [TestProperty("Description", "Attempts an offsets change while there is no child.")] - public void OffsetsChangeWithNoChild() + [TestProperty("Description", "Attempts an offsets change while there is no content.")] + public void OffsetsChangeWithNoContent() { Scroller scroller = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); @@ -615,7 +615,7 @@ public void OffsetsChangeWithNoChild() { scroller = new Scroller(); - SetupDefaultUI(scroller, null /*rectangleScrollerChild*/, scrollerLoadedEvent); + SetupDefaultUI(scroller, null /*rectangleScrollerContent*/, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -647,8 +647,8 @@ public void OffsetsChangeWithNoChild() } [TestMethod] - [TestProperty("Description", "Attempts a zoomFactor change while there is no child.")] - public void ZoomFactorChangeWithNoChild() + [TestProperty("Description", "Attempts a zoomFactor change while there is no content.")] + public void ZoomFactorChangeWithNoContent() { Scroller scroller = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); @@ -659,7 +659,7 @@ public void ZoomFactorChangeWithNoChild() { scroller = new Scroller(); - SetupDefaultUI(scroller, null /*rectangleScrollerChild*/, scrollerLoadedEvent); + SetupDefaultUI(scroller, null /*rectangleScrollerContent*/, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -695,17 +695,17 @@ public void ZoomFactorChangeWithNoChild() public void ConsecutiveOffsetJumps() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent[] scrollerViewChangeOperationEvents = null; ScrollerOperation[] operations = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -795,17 +795,17 @@ public void ConsecutiveZoomFactorJumps() } Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent[] scrollerViewChangeOperationEvents = null; ScrollerOperation[] operations = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); @@ -919,32 +919,32 @@ public void AnimateZoomFactorBeforeLoading() } [TestMethod] - [TestProperty("Description", "Requests a non-animated offset change immediately after increasing child size.")] - public void OffsetJumpAfterChildResizing() + [TestProperty("Description", "Requests a non-animated offset change immediately after increasing content size.")] + public void OffsetJumpAfterContentResizing() { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); RunOnUIThread.Execute(() => { - rectangleScrollerChild.Width = c_defaultUIScrollerChildWidth + 200.0; + rectangleScrollerContent.Width = c_defaultUIScrollerContentWidth + 200.0; }); // Jump to absolute offsets ChangeOffsets( scroller, - c_defaultUIScrollerChildWidth + 200.0 - c_defaultUIScrollerWidth, + c_defaultUIScrollerContentWidth + 200.0 - c_defaultUIScrollerWidth, c_defaultVerticalOffset, ScrollerViewKind.Absolute, ScrollerViewChangeKind.DisableAnimation, @@ -954,17 +954,17 @@ public void OffsetJumpAfterChildResizing() private void ChangeOffsetsBeforeLoading(bool animate) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent, false /*setAsContentRoot*/); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent, false /*setAsContentRoot*/); scroller.ViewChanged += (sender, args) => { @@ -1004,17 +1004,17 @@ private void ChangeOffsetsBeforeLoading(bool animate) private void ChangeZoomFactorBeforeLoading(bool animate) { Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent scrollerViewChangeOperationEvent = new AutoResetEvent(false); ScrollerOperation operation = null; RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent, false /*setAsContentRoot*/); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent, false /*setAsContentRoot*/); scroller.ViewChanged += (sender, args) => { @@ -1484,7 +1484,7 @@ private void InterruptViewChange( bool changeOffsetsSecond = viewChangeInterruptionKind == ViewChangeInterruptionKind.OffsetsChangeByOffsetsChange || viewChangeInterruptionKind == ViewChangeInterruptionKind.ZoomFactorChangeByOffsetsChange; Scroller scroller = null; - Rectangle rectangleScrollerChild = null; + Rectangle rectangleScrollerContent = null; AutoResetEvent scrollerLoadedEvent = new AutoResetEvent(false); AutoResetEvent[] scrollerViewChangeOperationEvents = null; ScrollerOperation[] operations = null; @@ -1492,10 +1492,10 @@ private void InterruptViewChange( RunOnUIThread.Execute(() => { - rectangleScrollerChild = new Rectangle(); + rectangleScrollerContent = new Rectangle(); scroller = new Scroller(); - SetupDefaultUI(scroller, rectangleScrollerChild, scrollerLoadedEvent); + SetupDefaultUI(scroller, rectangleScrollerContent, scrollerLoadedEvent); }); WaitForEvent("Waiting for Loaded event", scrollerLoadedEvent); diff --git a/dev/Scroller/InteractionTests/ScrollerTestsWithInputHelper.cs b/dev/Scroller/InteractionTests/ScrollerTestsWithInputHelper.cs index 8e3dc22d2d..5a2fe6a32a 100644 --- a/dev/Scroller/InteractionTests/ScrollerTestsWithInputHelper.cs +++ b/dev/Scroller/InteractionTests/ScrollerTestsWithInputHelper.cs @@ -141,7 +141,7 @@ public void PanWithRailing() Verify.IsTrue(scroller11.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scroller11 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%"); } - // scroller11's Child height is 1000px. + // scroller11's Content height is 1000px. double horizontalOffset; double verticalOffset; double minVerticalOffset = 1000.0 * (1.0 - scroller11.VerticalViewSize / 100.0) * minVerticalScrollPercent / 100.0; @@ -248,7 +248,7 @@ public void PanWithoutRailing() Verify.IsTrue(scroller51.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scroller51 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%"); } - // scroller51's Child size is 800x800px. + // scroller51's Content size is 800x800px. double horizontalOffset; double verticalOffset; double minHorizontalOffset = 800.0 * (1.0 - scroller51.HorizontalViewSize / 100.0) * minHorizontalScrollPercent / 100.0; @@ -337,7 +337,7 @@ public void ScrollWithMouseWheel() Verify.AreEqual(scroller11.HorizontalScrollPercent, 0.0, "Verifying scroller11 HorizontalScrollPercent is 0%"); Verify.IsTrue(scroller11.VerticalScrollPercent > minVerticalScrollPercent, "Verifying scroller11 VerticalScrollPercent is greater than " + minVerticalScrollPercent + "%"); - // scroller11's Child height is 1000px. + // scroller11's Content height is 1000px. double horizontalOffset; double verticalOffset; double minVerticalOffset = 1000.0 * (1.0 - scroller11.VerticalViewSize / 100.0) * minVerticalScrollPercent / 100.0; diff --git a/dev/Scroller/Scroller.cpp b/dev/Scroller/Scroller.cpp index 0d7e81a19f..d8e53bccf5 100644 --- a/dev/Scroller/Scroller.cpp +++ b/dev/Scroller/Scroller.cpp @@ -61,7 +61,7 @@ Scroller::Scroller() } // Set the default Transparent background so that hit-testing allows to start a touch manipulation - // outside the boundaries of the Child, when it's smaller than the Scroller. + // outside the boundaries of the Content, when it's smaller than the Scroller. Background(winrt::SolidColorBrush(winrt::Colors::Transparent())); } @@ -506,14 +506,14 @@ winrt::Size Scroller::MeasureOverride(winrt::Size const& availableSize) m_availableSize = availableSize; - winrt::Size childDesiredSize{ 0.0f, 0.0f }; - const winrt::UIElement child = Child(); + winrt::Size contentDesiredSize{ 0.0f, 0.0f }; + const winrt::UIElement content = Content(); - if (child) + if (content) { - // The child is measured with infinity in the directions in which it is not constrained, enabling this Scroller + // The content is measured with infinity in the directions in which it is not constrained, enabling this Scroller // to be scrollable in those directions. - winrt::Size childAvailableSize + winrt::Size contentAvailableSize { m_isChildAvailableWidthConstrained ? availableSize.Width : std::numeric_limits::infinity(), m_isChildAvailableHeightConstrained ? availableSize.Height : std::numeric_limits::infinity() @@ -521,44 +521,44 @@ winrt::Size Scroller::MeasureOverride(winrt::Size const& availableSize) if (m_isChildAvailableWidthConstrained || m_isChildAvailableHeightConstrained) { - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - winrt::Thickness childMargin = childAsFE.Margin(); + winrt::Thickness contentMargin = contentAsFE.Margin(); if (m_isChildAvailableWidthConstrained) { - // Even though the child's Width is constrained, take into account the MinWidth, Width and MaxWidth values - // potentially set on the child so it is allowed to grow accordingly. - childAvailableSize.Width = static_cast(GetComputedMaxWidth(availableSize.Width, childAsFE)); + // Even though the content's Width is constrained, take into account the MinWidth, Width and MaxWidth values + // potentially set on the content so it is allowed to grow accordingly. + contentAvailableSize.Width = static_cast(GetComputedMaxWidth(availableSize.Width, contentAsFE)); } if (m_isChildAvailableHeightConstrained) { - // Even though the child's Height is constrained, take into account the MinHeight, Height and MaxHeight values - // potentially set on the child so it is allowed to grow accordingly. - childAvailableSize.Height = static_cast(GetComputedMaxHeight(availableSize.Height, childAsFE)); + // Even though the content's Height is constrained, take into account the MinHeight, Height and MaxHeight values + // potentially set on the content so it is allowed to grow accordingly. + contentAvailableSize.Height = static_cast(GetComputedMaxHeight(availableSize.Height, contentAsFE)); } } } - child.Measure(childAvailableSize); - childDesiredSize = child.DesiredSize(); + content.Measure(contentAvailableSize); + contentDesiredSize = content.DesiredSize(); } // The framework determines that this Scroller is scrollable when unclippedDesiredSize.Width/Height > desiredSize.Width/Height - SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"childDesiredSize:", childDesiredSize.Width, childDesiredSize.Height); + SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"contentDesiredSize:", contentDesiredSize.Width, contentDesiredSize.Height); - return childDesiredSize; + return contentDesiredSize; } winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) { SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"finalSize", finalSize.Width, finalSize.Height); - const winrt::UIElement child = Child(); - winrt::Rect finalChildRect{}; + const winrt::UIElement content = Content(); + winrt::Rect finalContentRect{}; winrt::Size viewport = { isinf(m_availableSize.Width) ? finalSize.Width : m_availableSize.Width, @@ -567,49 +567,49 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) double newUnzoomedExtentWidth = 0.0; double newUnzoomedExtentHeight = 0.0; - if (child) + if (content) { - float childLayoutOffsetXDelta = 0.0f; - float childLayoutOffsetYDelta = 0.0f; + float contentLayoutOffsetXDelta = 0.0f; + float contentLayoutOffsetYDelta = 0.0f; bool isAnchoringElementHorizontally = false; bool isAnchoringElementVertically = false; bool isAnchoringFarEdgeHorizontally = false; bool isAnchoringFarEdgeVertically = false; - winrt::Size childArrangeSize = + winrt::Size contentArrangeSize = { - child.DesiredSize().Width, - child.DesiredSize().Height + content.DesiredSize().Width, + content.DesiredSize().Height }; - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch && - isnan(childAsFE.Width()) && - childArrangeSize.Width < viewport.Width) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch && + isnan(contentAsFE.Width()) && + contentArrangeSize.Width < viewport.Width) { - childArrangeSize.Width = viewport.Width; + contentArrangeSize.Width = viewport.Width; } - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch && - isnan(childAsFE.Height()) && - childArrangeSize.Height < viewport.Height) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch && + isnan(contentAsFE.Height()) && + contentArrangeSize.Height < viewport.Height) { - childArrangeSize.Height = viewport.Height; + contentArrangeSize.Height = viewport.Height; } } - finalChildRect = + finalContentRect = { - m_childLayoutOffsetX, - m_childLayoutOffsetY, - childArrangeSize.Width, - childArrangeSize.Height + m_contentLayoutOffsetX, + m_contentLayoutOffsetY, + contentArrangeSize.Width, + contentArrangeSize.Height }; - newUnzoomedExtentWidth = childArrangeSize.Width; - newUnzoomedExtentHeight = childArrangeSize.Height; + newUnzoomedExtentWidth = contentArrangeSize.Width; + newUnzoomedExtentHeight = contentArrangeSize.Height; IsAnchoring(&isAnchoringElementHorizontally, &isAnchoringElementVertically, &isAnchoringFarEdgeHorizontally, &isAnchoringFarEdgeVertically); @@ -635,8 +635,8 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) ResetAnchorElement(); } - SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"child Arrange", TypeLogging::RectToString(finalChildRect).c_str()); - child.Arrange(finalChildRect); + SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content Arrange", TypeLogging::RectToString(finalContentRect).c_str()); + content.Arrange(finalContentRect); if (!isnan(preArrangeViewportToElementAnchorPointsDistance.Width) || !isnan(preArrangeViewportToElementAnchorPointsDistance.Height)) { @@ -652,7 +652,7 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) preArrangeViewportToElementAnchorPointsDistance.Width != postArrangeViewportToElementAnchorPointsDistance.Width) { // Perform horizontal offset adjustment due to element anchoring - childLayoutOffsetXDelta = ComputeChildLayoutOffsetDelta( + contentLayoutOffsetXDelta = ComputeContentLayoutOffsetDelta( ScrollerDimension::HorizontalScroll, postArrangeViewportToElementAnchorPointsDistance.Width - preArrangeViewportToElementAnchorPointsDistance.Width /*unzoomedDelta*/); } @@ -663,7 +663,7 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) preArrangeViewportToElementAnchorPointsDistance.Height != postArrangeViewportToElementAnchorPointsDistance.Height) { // Perform vertical offset adjustment due to element anchoring - childLayoutOffsetYDelta = ComputeChildLayoutOffsetDelta( + contentLayoutOffsetYDelta = ComputeContentLayoutOffsetDelta( ScrollerDimension::VerticalScroll, postArrangeViewportToElementAnchorPointsDistance.Height - preArrangeViewportToElementAnchorPointsDistance.Height /*unzoomedDelta*/); } @@ -673,37 +673,37 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) { ResetAnchorElement(); - SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"child Arrange", TypeLogging::RectToString(finalChildRect).c_str()); - child.Arrange(finalChildRect); + SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content Arrange", TypeLogging::RectToString(finalContentRect).c_str()); + content.Arrange(finalContentRect); } - SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"child RenderSize", child.RenderSize().Width, child.RenderSize().Height); + SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"content RenderSize", content.RenderSize().Width, content.RenderSize().Height); - winrt::Thickness childMargin{}; + winrt::Thickness contentMargin{}; double maxUnzoomedExtentWidth = std::numeric_limits::infinity(); double maxUnzoomedExtentHeight = std::numeric_limits::infinity(); - if (childAsFE) + if (contentAsFE) { - childMargin = childAsFE.Margin(); + contentMargin = contentAsFE.Margin(); - // Determine the maximum size directly set on the child, if any. - maxUnzoomedExtentWidth = GetComputedMaxWidth(maxUnzoomedExtentWidth, childAsFE); - maxUnzoomedExtentHeight = GetComputedMaxHeight(maxUnzoomedExtentHeight, childAsFE); + // Determine the maximum size directly set on the content, if any. + maxUnzoomedExtentWidth = GetComputedMaxWidth(maxUnzoomedExtentWidth, contentAsFE); + maxUnzoomedExtentHeight = GetComputedMaxHeight(maxUnzoomedExtentHeight, contentAsFE); } // Take into account the actual resulting rendering size, in case it's larger than the desired size. - // But the extent must not exceed the size explicitly set on the child, if any. + // But the extent must not exceed the size explicitly set on the content, if any. newUnzoomedExtentWidth = std::max( newUnzoomedExtentWidth, - std::max(0.0, child.RenderSize().Width + childMargin.Left + childMargin.Right)); + std::max(0.0, content.RenderSize().Width + contentMargin.Left + contentMargin.Right)); newUnzoomedExtentWidth = std::min( newUnzoomedExtentWidth, maxUnzoomedExtentWidth); newUnzoomedExtentHeight = std::max( newUnzoomedExtentHeight, - std::max(0.0, child.RenderSize().Height + childMargin.Top + childMargin.Bottom)); + std::max(0.0, content.RenderSize().Height + contentMargin.Top + contentMargin.Bottom)); newUnzoomedExtentHeight = std::min( newUnzoomedExtentHeight, maxUnzoomedExtentHeight); @@ -726,8 +726,8 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) if (unzoomedDelta != 0.0f) { - MUX_ASSERT(childLayoutOffsetXDelta == 0.0f); - childLayoutOffsetXDelta = ComputeChildLayoutOffsetDelta(ScrollerDimension::HorizontalScroll, unzoomedDelta); + MUX_ASSERT(contentLayoutOffsetXDelta == 0.0f); + contentLayoutOffsetXDelta = ComputeContentLayoutOffsetDelta(ScrollerDimension::HorizontalScroll, unzoomedDelta); } } @@ -749,44 +749,44 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize) if (unzoomedDelta != 0.0f) { - MUX_ASSERT(childLayoutOffsetYDelta == 0.0f); - childLayoutOffsetYDelta = ComputeChildLayoutOffsetDelta(ScrollerDimension::VerticalScroll, unzoomedDelta); + MUX_ASSERT(contentLayoutOffsetYDelta == 0.0f); + contentLayoutOffsetYDelta = ComputeContentLayoutOffsetDelta(ScrollerDimension::VerticalScroll, unzoomedDelta); } } - if (childLayoutOffsetXDelta != 0.0f || childLayoutOffsetYDelta != 0.0f) + if (contentLayoutOffsetXDelta != 0.0f || contentLayoutOffsetYDelta != 0.0f) { - winrt::Rect childRectWithDelta = + winrt::Rect contentRectWithDelta = { - m_childLayoutOffsetX + childLayoutOffsetXDelta, - m_childLayoutOffsetY + childLayoutOffsetYDelta, - childArrangeSize.Width, - childArrangeSize.Height + m_contentLayoutOffsetX + contentLayoutOffsetXDelta, + m_contentLayoutOffsetY + contentLayoutOffsetYDelta, + contentArrangeSize.Width, + contentArrangeSize.Height }; - SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"child Arrange", TypeLogging::RectToString(childRectWithDelta).c_str()); - child.Arrange(childRectWithDelta); + SCROLLER_TRACE_INFO(*this, TRACE_MSG_METH_STR_STR, METH_NAME, this, L"content Arrange", TypeLogging::RectToString(contentRectWithDelta).c_str()); + content.Arrange(contentRectWithDelta); - if (childLayoutOffsetXDelta != 0.0f) + if (contentLayoutOffsetXDelta != 0.0f) { - m_childLayoutOffsetX += childLayoutOffsetXDelta; - UpdateOffset(ScrollerDimension::HorizontalScroll, m_zoomedHorizontalOffset - childLayoutOffsetXDelta); - OnChildLayoutOffsetChanged(ScrollerDimension::HorizontalScroll); + m_contentLayoutOffsetX += contentLayoutOffsetXDelta; + UpdateOffset(ScrollerDimension::HorizontalScroll, m_zoomedHorizontalOffset - contentLayoutOffsetXDelta); + OnContentLayoutOffsetChanged(ScrollerDimension::HorizontalScroll); } - if (childLayoutOffsetYDelta != 0.0f) + if (contentLayoutOffsetYDelta != 0.0f) { - m_childLayoutOffsetY += childLayoutOffsetYDelta; - UpdateOffset(ScrollerDimension::VerticalScroll, m_zoomedVerticalOffset - childLayoutOffsetYDelta); - OnChildLayoutOffsetChanged(ScrollerDimension::VerticalScroll); + m_contentLayoutOffsetY += contentLayoutOffsetYDelta; + UpdateOffset(ScrollerDimension::VerticalScroll, m_zoomedVerticalOffset - contentLayoutOffsetYDelta); + OnContentLayoutOffsetChanged(ScrollerDimension::VerticalScroll); } - OnViewChanged(childLayoutOffsetXDelta != 0.0f /*horizontalOffsetChanged*/, childLayoutOffsetYDelta != 0.0f /*verticalOffsetChanged*/); + OnViewChanged(contentLayoutOffsetXDelta != 0.0f /*horizontalOffsetChanged*/, contentLayoutOffsetYDelta != 0.0f /*verticalOffsetChanged*/); } } // Set a rectangular clip on this Scroller the same size as the arrange - // rectangle so the child does not render beyond it. + // rectangle so the content does not render beyond it. winrt::RectangleGeometry rectangleGeometry = safe_cast(Clip()); if (!rectangleGeometry) @@ -988,9 +988,9 @@ void Scroller::ValuesChanged( #pragma endregion -// Used to perform a flickerless change to the Child's XAML Layout Offset. The InteractionTracker's Position is unaffected, but its Min/MaxPosition expressions +// Used to perform a flickerless change to the Content's XAML Layout Offset. The InteractionTracker's Position is unaffected, but its Min/MaxPosition expressions // and the Scroller HorizontalOffset/VerticalOffset property are updated accordingly once the change is incorporated into the XAML layout engine. -float Scroller::ComputeChildLayoutOffsetDelta(ScrollerDimension dimension, float unzoomedDelta) const +float Scroller::ComputeContentLayoutOffsetDelta(ScrollerDimension dimension, float unzoomedDelta) const { MUX_ASSERT(dimension == ScrollerDimension::HorizontalScroll || dimension == ScrollerDimension::VerticalScroll); @@ -1060,7 +1060,7 @@ winrt::float2 Scroller::ComputeEndOfInertiaPosition() } // Returns zoomed vectors corresponding to InteractionTracker.MinPosition and InteractionTracker.MaxPosition -// Determines the min and max positions of the Scroller.Child based on its size and alignment, and the Scroller size. +// Determines the min and max positions of the Scroller.Content based on its size and alignment, and the Scroller size. void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* minPosition, _Out_opt_ winrt::float2* maxPosition) { MUX_ASSERT(minPosition || maxPosition); @@ -1075,16 +1075,16 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* *maxPosition = winrt::float2::zero(); } - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (!child) + if (!content) { return; } - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (!childAsFE) + if (!contentAsFE) { return; } @@ -1097,8 +1097,8 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* float extentWidth = static_cast(m_unzoomedExtentWidth); float extentHeight = static_cast(m_unzoomedExtentHeight); - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { float scrollableWidth = extentWidth * zoomFactor - scrollerVisual.Size().x; @@ -1120,7 +1120,7 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* } } } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { float scrollableWidth = extentWidth * zoomFactor - scrollerVisual.Size().x; @@ -1143,8 +1143,8 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* } } - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { float scrollableHeight = extentHeight * zoomFactor - scrollerVisual.Size().y; @@ -1166,7 +1166,7 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* } } } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { float scrollableHeight = extentHeight * zoomFactor - scrollerVisual.Size().y; @@ -1191,12 +1191,12 @@ void Scroller::ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* if (minPosition) { - *minPosition = winrt::float2(minPosX + m_childLayoutOffsetX, minPosY + m_childLayoutOffsetY); + *minPosition = winrt::float2(minPosX + m_contentLayoutOffsetX, minPosY + m_contentLayoutOffsetY); } if (maxPosition) { - *maxPosition = winrt::float2(maxPosX + m_childLayoutOffsetX, maxPosY + m_childLayoutOffsetY); + *maxPosition = winrt::float2(maxPosX + m_contentLayoutOffsetX, maxPosY + m_contentLayoutOffsetY); } } @@ -1226,16 +1226,16 @@ double Scroller::ComputeValueAfterSnapPoints(double value, const std::set(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (!childAsFE) + if (!contentAsFE) { return winrt::float2{ centerPointX, centerPointY }; } @@ -1243,20 +1243,20 @@ winrt::float2 Scroller::ComputeCenterPointerForMouseWheelZooming(const winrt::UI if (m_unzoomedExtentWidth * m_zoomFactor < m_viewportWidth) { // Viewport is wider than content - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { // Use the center of the viewport (and content) as the center point centerPointX = static_cast(m_viewportWidth / 2.0); } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { // Use the right viewport edge as the center point centerPointX = static_cast(m_viewportWidth); } else { - MUX_ASSERT(childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Left); + MUX_ASSERT(contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Left); // Use the left viewport edge as the center point centerPointX = 0.0f; @@ -1267,20 +1267,20 @@ winrt::float2 Scroller::ComputeCenterPointerForMouseWheelZooming(const winrt::UI if (m_unzoomedExtentHeight * m_zoomFactor < m_viewportHeight) { // Viewport is wider than content - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { // Use the center of the viewport (and content) as the center point centerPointY = static_cast(m_viewportHeight / 2.0); } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { // Use the bottom viewport edge as the center point centerPointY = static_cast(m_viewportHeight); } else { - MUX_ASSERT(childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Top); + MUX_ASSERT(contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Top); // Use the top viewport edge as the center point centerPointY = 0.0f; @@ -1292,7 +1292,7 @@ winrt::float2 Scroller::ComputeCenterPointerForMouseWheelZooming(const winrt::UI } void Scroller::ComputeBringIntoViewTargetOffsets( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::BringIntoViewRequestedEventArgs& requestEventArgs, _Out_ double* targetZoomedHorizontalOffset, _Out_ double* targetZoomedVerticalOffset, @@ -1310,10 +1310,10 @@ void Scroller::ComputeBringIntoViewTargetOffsets( const winrt::UIElement target = requestEventArgs.TargetElement(); - MUX_ASSERT(child); + MUX_ASSERT(content); MUX_ASSERT(target); - winrt::Rect transformedRect = GetDescendantBounds(child, target, requestEventArgs.TargetRect()); + winrt::Rect transformedRect = GetDescendantBounds(content, target, requestEventArgs.TargetRect()); double targetX = transformedRect.X; double targetWidth = transformedRect.Width; @@ -1425,7 +1425,7 @@ void Scroller::EnsureExpressionAnimationSources() m_expressionAnimationSources = compositor.CreatePropertySet(); m_expressionAnimationSources.InsertVector2(s_extentSourcePropertyName, { 0.0f, 0.0f }); m_expressionAnimationSources.InsertVector2(s_viewportSourcePropertyName, { 0.0f, 0.0f }); - m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_childLayoutOffsetX, m_childLayoutOffsetY }); + m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_contentLayoutOffsetX, m_contentLayoutOffsetY }); m_expressionAnimationSources.InsertVector2(s_positionSourcePropertyName, { 0.0f, 0.0f }); m_expressionAnimationSources.InsertVector2(s_minPositionSourcePropertyName, { 0.0f, 0.0f }); m_expressionAnimationSources.InsertVector2(s_maxPositionSourcePropertyName, { 0.0f, 0.0f }); @@ -1767,12 +1767,12 @@ void Scroller::SetupInteractionTrackerBoundaries() MaxZoomFactor()); } - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (child && (!m_minPositionExpressionAnimation || !m_maxPositionExpressionAnimation)) + if (content && (!m_minPositionExpressionAnimation || !m_maxPositionExpressionAnimation)) { EnsurePositionBoundariesExpressionAnimations(); - SetupPositionBoundariesExpressionAnimations(child); + SetupPositionBoundariesExpressionAnimations(content); } } @@ -2009,7 +2009,7 @@ void Scroller::SetupScrollControllerVisualInterationSource( // Configures the Position input modifiers of the VisualInteractionSource associated // with an IScrollController Visual. The scalar called Multiplier from the CompositionPropertySet // used in IScrollController::SetExpressionAnimationSources determines the relative speed of -// IScrollController::InteractionVisual compared to the Scroller.Child element. +// IScrollController::InteractionVisual compared to the Scroller.Content element. // The InteractionVisual is clamped based on the Interaction's MinPosition and MaxPosition values. // Four CompositionConditionalValue instances cover all scenarios: // - the Position is moved closer to InteractionTracker.MinPosition while the multiplier is negative. @@ -2017,7 +2017,7 @@ void Scroller::SetupScrollControllerVisualInterationSource( // - the Position is moved closer to InteractionTracker.MaxPosition while the multiplier is negative. // - the Position is moved closer to InteractionTracker.MaxPosition while the multiplier is positive. void Scroller::SetupScrollControllerVisualInterationSourcePositionModifiers( - ScrollerDimension dimension, // Direction of the Scroller.Child Visual movement. + ScrollerDimension dimension, // Direction of the Scroller.Content Visual movement. const winrt::Orientation& orientation) // Direction of the IScrollController's Visual movement. { MUX_ASSERT(SharedHelpers::IsRS2OrHigher()); @@ -2093,8 +2093,8 @@ void Scroller::SetupScrollControllerVisualInterationSourcePositionModifiers( values[3].Expression(expressionClampToMinPosition); scrollControllerVisualInteractionSource.ConfigureDeltaPositionYModifiers(modifiersVector); - // When the IScrollController's Visual moves horizontally and controls the vertical Scroller.Child movement, make sure that the - // vertical finger movements do not affect the Scroller.Child vertically. The vertical component of the finger movement is filtered out. + // When the IScrollController's Visual moves horizontally and controls the vertical Scroller.Content movement, make sure that the + // vertical finger movements do not affect the Scroller.Content vertically. The vertical component of the finger movement is filtered out. winrt::CompositionConditionalValue ccvOrtho = winrt::CompositionConditionalValue::Create(compositor); winrt::ExpressionAnimation conditionOrtho = compositor.CreateExpressionAnimation(L"true"); winrt::ExpressionAnimation valueOrtho = compositor.CreateExpressionAnimation(L"0"); @@ -2124,8 +2124,8 @@ void Scroller::SetupScrollControllerVisualInterationSourcePositionModifiers( values[3].Expression(expressionClampToMinPosition); scrollControllerVisualInteractionSource.ConfigureDeltaPositionXModifiers(modifiersVector); - // When the IScrollController's Visual moves vertically and controls the horizontal Scroller.Child movement, make sure that the - // horizontal finger movements do not affect the Scroller.Child horizontally. The horizontal component of the finger movement is filtered out. + // When the IScrollController's Visual moves vertically and controls the horizontal Scroller.Content movement, make sure that the + // horizontal finger movements do not affect the Scroller.Content horizontally. The horizontal component of the finger movement is filtered out. winrt::CompositionConditionalValue ccvOrtho = winrt::CompositionConditionalValue::Create(compositor); winrt::ExpressionAnimation conditionOrtho = compositor.CreateExpressionAnimation(L"true"); winrt::ExpressionAnimation valueOrtho = compositor.CreateExpressionAnimation(L"0"); @@ -2288,7 +2288,7 @@ void Scroller::SetupVisualInteractionSourceCenterPointModifier( MUX_ASSERT(dimension == ScrollerDimension::HorizontalScroll || dimension == ScrollerDimension::VerticalScroll); MUX_ASSERT(m_interactionTracker); - float xamlLayoutOffset = dimension == ScrollerDimension::HorizontalScroll ? m_childLayoutOffsetX : m_childLayoutOffsetY; + float xamlLayoutOffset = dimension == ScrollerDimension::HorizontalScroll ? m_contentLayoutOffsetX : m_contentLayoutOffsetY; if (xamlLayoutOffset == 0.0f) { @@ -2357,7 +2357,7 @@ winrt::ScrollMode Scroller::GetComputedScrollMode(ScrollerDimension dimension, b { if (!ignoreZoomMode && ZoomMode() == winrt::ZoomMode::Enabled) { - // Allow scrolling when zooming is turned on so that the Child does not get stuck in the given dimension + // Allow scrolling when zooming is turned on so that the Content does not get stuck in the given dimension // when it becomes smaller than the viewport. newComputedScrollMode = winrt::ScrollMode::Enabled; } @@ -2365,12 +2365,12 @@ winrt::ScrollMode Scroller::GetComputedScrollMode(ScrollerDimension dimension, b { if (dimension == ScrollerDimension::HorizontalScroll) { - // Enable horizontal scrolling only when the Child's width is larger than the Scroller's width + // Enable horizontal scrolling only when the Content's width is larger than the Scroller's width newComputedScrollMode = GetZoomedExtentWidth() > GetViewportWidth() ? winrt::ScrollMode::Enabled : winrt::ScrollMode::Disabled; } else { - // Enable vertical scrolling only when the Child's height is larger than the Scroller's height + // Enable vertical scrolling only when the Content's height is larger than the Scroller's height newComputedScrollMode = GetZoomedExtentHeight() > GetViewportHeight() ? winrt::ScrollMode::Enabled : winrt::ScrollMode::Disabled; } } @@ -2414,16 +2414,16 @@ winrt::ZoomMode Scroller::GetMouseWheelZoomMode() double Scroller::GetComputedMaxWidth( double defaultMaxWidth, - const winrt::FrameworkElement& child) const + const winrt::FrameworkElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - winrt::Thickness childMargin = child.Margin(); - double marginWidth = childMargin.Left + childMargin.Right; + winrt::Thickness contentMargin = content.Margin(); + double marginWidth = contentMargin.Left + contentMargin.Right; double computedMaxWidth = defaultMaxWidth; - double width = child.Width(); - double minWidth = child.MinWidth(); - double maxWidth = child.MaxWidth(); + double width = content.Width(); + double minWidth = content.MinWidth(); + double maxWidth = content.MaxWidth(); if (!isnan(width)) { @@ -2446,16 +2446,16 @@ double Scroller::GetComputedMaxWidth( double Scroller::GetComputedMaxHeight( double defaultMaxHeight, - const winrt::FrameworkElement& child) const + const winrt::FrameworkElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - winrt::Thickness childMargin = child.Margin(); - double marginHeight = childMargin.Top + childMargin.Bottom; + winrt::Thickness contentMargin = content.Margin(); + double marginHeight = contentMargin.Top + contentMargin.Bottom; double computedMaxHeight = defaultMaxHeight; - double height = child.Height(); - double minHeight = child.MinHeight(); - double maxHeight = child.MaxHeight(); + double height = content.Height(); + double minHeight = content.MinHeight(); + double maxHeight = content.MaxHeight(); if (!isnan(height)) { @@ -2476,21 +2476,21 @@ double Scroller::GetComputedMaxHeight( return computedMaxHeight; } -// Computes the child's layout offsets at zoomFactor 1 coming from the Margin property and the difference between the extent and render sizes. +// Computes the content's layout offsets at zoomFactor 1 coming from the Margin property and the difference between the extent and render sizes. winrt::float2 Scroller::GetArrangeRenderSizesDelta( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - double deltaX = m_unzoomedExtentWidth - child.RenderSize().Width; - double deltaY = m_unzoomedExtentHeight - child.RenderSize().Height; + double deltaX = m_unzoomedExtentWidth - content.RenderSize().Width; + double deltaY = m_unzoomedExtentHeight - content.RenderSize().Height; - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - winrt::HorizontalAlignment horizontalAlignment = childAsFE.HorizontalAlignment(); - winrt::VerticalAlignment verticalAlignment = childAsFE.VerticalAlignment(); + winrt::HorizontalAlignment horizontalAlignment = contentAsFE.HorizontalAlignment(); + winrt::VerticalAlignment verticalAlignment = contentAsFE.VerticalAlignment(); if (horizontalAlignment == winrt::HorizontalAlignment::Stretch) { @@ -2502,18 +2502,18 @@ winrt::float2 Scroller::GetArrangeRenderSizesDelta( deltaY = 0.0; } - const winrt::Thickness childMargin = childAsFE.Margin(); + const winrt::Thickness contentMargin = contentAsFE.Margin(); if (horizontalAlignment == winrt::HorizontalAlignment::Center || horizontalAlignment == winrt::HorizontalAlignment::Right) { - deltaX -= childMargin.Left + childMargin.Right; + deltaX -= contentMargin.Left + contentMargin.Right; } if (verticalAlignment == winrt::VerticalAlignment::Center || verticalAlignment == winrt::VerticalAlignment::Bottom) { - deltaY -= childMargin.Top + childMargin.Bottom; + deltaY -= contentMargin.Top + contentMargin.Bottom; } if (horizontalAlignment == winrt::HorizontalAlignment::Center || @@ -2536,129 +2536,129 @@ winrt::float2 Scroller::GetArrangeRenderSizesDelta( deltaY = 0.0f; } - deltaX += childMargin.Left; - deltaY += childMargin.Top; + deltaX += contentMargin.Left; + deltaY += contentMargin.Top; } return winrt::float2{ static_cast(deltaX), static_cast(deltaY) }; } -// Returns the expression for the m_minPositionExpressionAnimation animation based on the Child.HorizontalAlignment, -// Child.VerticalAlignment, InteractionTracker.Scale, Child arrange size (which takes Child.Margin into account) and +// Returns the expression for the m_minPositionExpressionAnimation animation based on the Content.HorizontalAlignment, +// Content.VerticalAlignment, InteractionTracker.Scale, Content arrange size (which takes Content.Margin into account) and // ScrollerVisual.Size properties. winrt::hstring Scroller::GetMinPositionExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMinPositionXExpression(child).c_str(), GetMinPositionYExpression(child).c_str()); + return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMinPositionXExpression(content).c_str(), GetMinPositionYExpression(content).c_str()); } winrt::hstring Scroller::GetMinPositionXExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - std::wstring_view maxOffset{ L"childSizeX * it.Scale - scrollerVisual.Size.X" }; + std::wstring_view maxOffset{ L"contentSizeX * it.Scale - scrollerVisual.Size.X" }; - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { - return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + childLayoutOffsetX", maxOffset.data()); + return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + contentLayoutOffsetX", maxOffset.data()); } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { - return StringUtil::FormatString(L"Min(0.0f, %1!s!) + childLayoutOffsetX", maxOffset.data()); + return StringUtil::FormatString(L"Min(0.0f, %1!s!) + contentLayoutOffsetX", maxOffset.data()); } } - return winrt::hstring(L"childLayoutOffsetX"); + return winrt::hstring(L"contentLayoutOffsetX"); } winrt::hstring Scroller::GetMinPositionYExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - std::wstring_view maxOffset = L"childSizeY * it.Scale - scrollerVisual.Size.Y"; + std::wstring_view maxOffset = L"contentSizeY * it.Scale - scrollerVisual.Size.Y"; - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { - return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + childLayoutOffsetY", maxOffset.data()); + return StringUtil::FormatString(L"Min(0.0f, (%1!s!) / 2.0f) + contentLayoutOffsetY", maxOffset.data()); } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { - return StringUtil::FormatString(L"Min(0.0f, %1!s!) + childLayoutOffsetY", maxOffset.data()); + return StringUtil::FormatString(L"Min(0.0f, %1!s!) + contentLayoutOffsetY", maxOffset.data()); } } - return winrt::hstring(L"childLayoutOffsetY"); + return winrt::hstring(L"contentLayoutOffsetY"); } -// Returns the expression for the m_maxPositionExpressionAnimation animation based on the Child.HorizontalAlignment, -// Child.VerticalAlignment, InteractionTracker.Scale, Child arrange size (which takes Child.Margin into account) and +// Returns the expression for the m_maxPositionExpressionAnimation animation based on the Content.HorizontalAlignment, +// Content.VerticalAlignment, InteractionTracker.Scale, Content arrange size (which takes Content.Margin into account) and // ScrollerVisual.Size properties. winrt::hstring Scroller::GetMaxPositionExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMaxPositionXExpression(child).c_str(), GetMaxPositionYExpression(child).c_str()); + return StringUtil::FormatString(L"Vector3(%1!s!, %2!s!, 0.0f)", GetMaxPositionXExpression(content).c_str(), GetMaxPositionYExpression(content).c_str()); } winrt::hstring Scroller::GetMaxPositionXExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - std::wstring_view maxOffset{ L"(childSizeX * it.Scale - scrollerVisual.Size.X)" }; + std::wstring_view maxOffset{ L"(contentSizeX * it.Scale - scrollerVisual.Size.X)" }; - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { - return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + childLayoutOffsetX : %1!s! / 2.0f + childLayoutOffsetX", maxOffset.data()); + return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + contentLayoutOffsetX : %1!s! / 2.0f + contentLayoutOffsetX", maxOffset.data()); } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { - return StringUtil::FormatString(L"%1!s! + childLayoutOffsetX", maxOffset.data()); + return StringUtil::FormatString(L"%1!s! + contentLayoutOffsetX", maxOffset.data()); } } - return winrt::hstring(L"Max(0.0f, childSizeX * it.Scale - scrollerVisual.Size.X) + childLayoutOffsetX"); + return winrt::hstring(L"Max(0.0f, contentSizeX * it.Scale - scrollerVisual.Size.X) + contentLayoutOffsetX"); } winrt::hstring Scroller::GetMaxPositionYExpression( - const winrt::UIElement& child) const + const winrt::UIElement& content) const { - MUX_ASSERT(child); + MUX_ASSERT(content); - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - std::wstring_view maxOffset{ L"(childSizeY * it.Scale - scrollerVisual.Size.Y)" }; + std::wstring_view maxOffset{ L"(contentSizeY * it.Scale - scrollerVisual.Size.Y)" }; - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { - return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + childLayoutOffsetY : %1!s! / 2.0f + childLayoutOffsetY", maxOffset.data()); + return StringUtil::FormatString(L"%1!s! >= 0 ? %1!s! + contentLayoutOffsetY : %1!s! / 2.0f + contentLayoutOffsetY", maxOffset.data()); } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { - return StringUtil::FormatString(L"%1!s! + childLayoutOffsetY", maxOffset.data()); + return StringUtil::FormatString(L"%1!s! + contentLayoutOffsetY", maxOffset.data()); } } - return winrt::hstring(L"Max(0.0f, childSizeY * it.Scale - scrollerVisual.Size.Y) + childLayoutOffsetY"); + return winrt::hstring(L"Max(0.0f, contentSizeY * it.Scale - scrollerVisual.Size.Y) + contentLayoutOffsetY"); } winrt::CompositionAnimation Scroller::GetPositionAnimation( @@ -2761,9 +2761,9 @@ int Scroller::GetNextViewChangeId() } void Scroller::SetupPositionBoundariesExpressionAnimations( - const winrt::UIElement& child) + const winrt::UIElement& content) { - MUX_ASSERT(child); + MUX_ASSERT(content); MUX_ASSERT(m_minPositionExpressionAnimation); MUX_ASSERT(m_maxPositionExpressionAnimation); MUX_ASSERT(m_interactionTracker); @@ -2778,7 +2778,7 @@ void Scroller::SetupPositionBoundariesExpressionAnimations( m_minPositionExpressionAnimation.SetReferenceParameter(L"scrollerVisual", scrollerVisual); } - m_minPositionExpressionAnimation.Expression(GetMinPositionExpression(child)); + m_minPositionExpressionAnimation.Expression(GetMinPositionExpression(content)); s = m_maxPositionExpressionAnimation.Expression(); @@ -2788,17 +2788,17 @@ void Scroller::SetupPositionBoundariesExpressionAnimations( m_maxPositionExpressionAnimation.SetReferenceParameter(L"scrollerVisual", scrollerVisual); } - m_maxPositionExpressionAnimation.Expression(GetMaxPositionExpression(child)); + m_maxPositionExpressionAnimation.Expression(GetMaxPositionExpression(content)); - UpdatePositionBoundaries(child); + UpdatePositionBoundaries(content); } void Scroller::SetupTransformExpressionAnimations( - const winrt::UIElement& child) + const winrt::UIElement& content) { const bool useTranslationProperty = IsVisualTranslationPropertyAvailable(); - MUX_ASSERT(child); + MUX_ASSERT(content); MUX_ASSERT(m_translationExpressionAnimation || !useTranslationProperty); MUX_ASSERT(m_transformMatrixTranslateXExpressionAnimation || useTranslationProperty); MUX_ASSERT(m_transformMatrixTranslateYExpressionAnimation || useTranslationProperty); @@ -2806,7 +2806,7 @@ void Scroller::SetupTransformExpressionAnimations( MUX_ASSERT(m_transformMatrixZoomFactorExpressionAnimation || useTranslationProperty); MUX_ASSERT(m_interactionTracker); - winrt::float2 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta(child); + winrt::float2 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta(content); SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT_FLT, METH_NAME, this, L"arrangeRenderSizesDelta", arrangeRenderSizesDelta.x, arrangeRenderSizesDelta.y); @@ -2837,65 +2837,65 @@ void Scroller::SetupTransformExpressionAnimations( m_transformMatrixZoomFactorExpressionAnimation.SetReferenceParameter(L"it", m_interactionTracker); } - StartTransformExpressionAnimations(child); + StartTransformExpressionAnimations(content); } void Scroller::StartTransformExpressionAnimations( - const winrt::UIElement& child) + const winrt::UIElement& content) { - if (child) + if (content) { - if (SharedHelpers::IsTranslationFacadeAvailable(child)) + if (SharedHelpers::IsTranslationFacadeAvailable(content)) { m_translationExpressionAnimation.Target(GetVisualTargetedPropertyName(ScrollerDimension::Scroll)); m_zoomFactorExpressionAnimation.Target(GetVisualTargetedPropertyName(ScrollerDimension::ZoomFactor)); - child.StartAnimation(m_translationExpressionAnimation); - child.StartAnimation(m_zoomFactorExpressionAnimation); + content.StartAnimation(m_translationExpressionAnimation); + content.StartAnimation(m_zoomFactorExpressionAnimation); } else { - const winrt::Visual childVisual = winrt::ElementCompositionPreview::GetElementVisual(child); + const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(content); if (IsVisualTranslationPropertyAvailable()) { - winrt::ElementCompositionPreview::SetIsTranslationEnabled(child, true); - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::Scroll), m_translationExpressionAnimation); - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::ZoomFactor), m_zoomFactorExpressionAnimation); + winrt::ElementCompositionPreview::SetIsTranslationEnabled(content, true); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::Scroll), m_translationExpressionAnimation); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::ZoomFactor), m_zoomFactorExpressionAnimation); } else { - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalScroll), m_transformMatrixTranslateXExpressionAnimation); - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalScroll), m_transformMatrixTranslateYExpressionAnimation); - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalZoomFactor), m_transformMatrixZoomFactorExpressionAnimation); - childVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalZoomFactor), m_transformMatrixZoomFactorExpressionAnimation); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalScroll), m_transformMatrixTranslateXExpressionAnimation); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalScroll), m_transformMatrixTranslateYExpressionAnimation); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalZoomFactor), m_transformMatrixZoomFactorExpressionAnimation); + contentVisual.StartAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalZoomFactor), m_transformMatrixZoomFactorExpressionAnimation); } } } } void Scroller::StopTransformExpressionAnimations( - const winrt::UIElement& child) + const winrt::UIElement& content) { - if (child) + if (content) { - if (SharedHelpers::IsTranslationFacadeAvailable(child)) + if (SharedHelpers::IsTranslationFacadeAvailable(content)) { - child.StopAnimation(m_translationExpressionAnimation); - child.StopAnimation(m_zoomFactorExpressionAnimation); + content.StopAnimation(m_translationExpressionAnimation); + content.StopAnimation(m_zoomFactorExpressionAnimation); } else { - const winrt::Visual childVisual = winrt::ElementCompositionPreview::GetElementVisual(child); + const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(content); if (IsVisualTranslationPropertyAvailable()) { - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::Scroll)); - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::ZoomFactor)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::Scroll)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::ZoomFactor)); } else { - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalScroll)); - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalScroll)); - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalZoomFactor)); - childVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalZoomFactor)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalScroll)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalScroll)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::HorizontalZoomFactor)); + contentVisual.StopAnimation(GetVisualTargetedPropertyName(ScrollerDimension::VerticalZoomFactor)); } } } @@ -3038,10 +3038,10 @@ double Scroller::ComputeZoomedOffsetWithMinimalChange( bool larger = (childEnd - childStart) > (viewportEnd - viewportStart); // # CHILD POSITION CHILD SIZE SCROLL REMEDY - // 1 Above viewport <= viewport Down Align top edge of child & viewport - // 2 Above viewport > viewport Down Align bottom edge of child & viewport - // 3 Below viewport <= viewport Up Align bottom edge of child & viewport - // 4 Below viewport > viewport Up Align top edge of child & viewport + // 1 Above viewport <= viewport Down Align top edge of content & viewport + // 2 Above viewport > viewport Down Align bottom edge of content & viewport + // 3 Below viewport <= viewport Up Align bottom edge of content & viewport + // 4 Below viewport > viewport Up Align top edge of content & viewport // 5 Entirely within viewport NA No change // 6 Spanning viewport NA No change if ((above && !larger) || (below && larger)) @@ -3060,24 +3060,24 @@ double Scroller::ComputeZoomedOffsetWithMinimalChange( } winrt::Rect Scroller::GetDescendantBounds( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::UIElement& descendant, const winrt::Rect& descendantRect) { - MUX_ASSERT(child); + MUX_ASSERT(content); - const winrt::FrameworkElement childAsFE = child.try_as(); - const winrt::GeneralTransform transform = descendant.TransformToVisual(child); - winrt::Thickness childMargin{}; + const winrt::FrameworkElement contentAsFE = content.try_as(); + const winrt::GeneralTransform transform = descendant.TransformToVisual(content); + winrt::Thickness contentMargin{}; - if (childAsFE) + if (contentAsFE) { - childMargin = childAsFE.Margin(); + contentMargin = contentAsFE.Margin(); } return transform.TransformBounds(winrt::Rect{ - static_cast(childMargin.Left + descendantRect.X), - static_cast(childMargin.Top + descendantRect.Y), + static_cast(contentMargin.Left + descendantRect.X), + static_cast(contentMargin.Top + descendantRect.Y), descendantRect.Width, descendantRect.Height }); } @@ -3164,34 +3164,34 @@ void Scroller::ValidateAnchorRatio(double value) bool Scroller::IsElementValidAnchor( const winrt::UIElement& element) { - return IsElementValidAnchor(element, Child()); + return IsElementValidAnchor(element, Content()); } // Invoked by ScrollerTestHooks -void Scroller::SetChildLayoutOffsetX(float childLayoutOffsetX) +void Scroller::SetContentLayoutOffsetX(float contentLayoutOffsetX) { - SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, childLayoutOffsetX, m_childLayoutOffsetX); + SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, contentLayoutOffsetX, m_contentLayoutOffsetX); - if (m_childLayoutOffsetX != childLayoutOffsetX) + if (m_contentLayoutOffsetX != contentLayoutOffsetX) { - UpdateOffset(ScrollerDimension::HorizontalScroll, m_zoomedHorizontalOffset + childLayoutOffsetX - m_childLayoutOffsetX); - m_childLayoutOffsetX = childLayoutOffsetX; + UpdateOffset(ScrollerDimension::HorizontalScroll, m_zoomedHorizontalOffset + contentLayoutOffsetX - m_contentLayoutOffsetX); + m_contentLayoutOffsetX = contentLayoutOffsetX; InvalidateArrange(); - OnChildLayoutOffsetChanged(ScrollerDimension::HorizontalScroll); + OnContentLayoutOffsetChanged(ScrollerDimension::HorizontalScroll); OnViewChanged(true /*horizontalOffsetChanged*/, false /*verticalOffsetChanged*/); } } -void Scroller::SetChildLayoutOffsetY(float childLayoutOffsetY) +void Scroller::SetContentLayoutOffsetY(float contentLayoutOffsetY) { - SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, childLayoutOffsetY, m_childLayoutOffsetY); + SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_FLT_FLT, METH_NAME, this, contentLayoutOffsetY, m_contentLayoutOffsetY); - if (m_childLayoutOffsetY != childLayoutOffsetY) + if (m_contentLayoutOffsetY != contentLayoutOffsetY) { - UpdateOffset(ScrollerDimension::VerticalScroll, m_zoomedVerticalOffset + childLayoutOffsetY - m_childLayoutOffsetY); - m_childLayoutOffsetY = childLayoutOffsetY; + UpdateOffset(ScrollerDimension::VerticalScroll, m_zoomedVerticalOffset + contentLayoutOffsetY - m_contentLayoutOffsetY); + m_contentLayoutOffsetY = contentLayoutOffsetY; InvalidateArrange(); - OnChildLayoutOffsetChanged(ScrollerDimension::VerticalScroll); + OnContentLayoutOffsetChanged(ScrollerDimension::VerticalScroll); OnViewChanged(false /*horizontalOffsetChanged*/, true /*verticalOffsetChanged*/); } } @@ -3232,11 +3232,11 @@ void Scroller::OnPropertyChanged( SCROLLER_TRACE_VERBOSE(nullptr, L"%s(property: %s)\n", METH_NAME, DependencyPropertyToString(dependencyProperty).c_str()); #endif - if (dependencyProperty == s_ChildProperty) + if (dependencyProperty == s_ContentProperty) { - const winrt::IInspectable oldChild = args.OldValue(); - const winrt::IInspectable newChild = args.NewValue(); - UpdateChild(safe_cast(oldChild), safe_cast(newChild)); + const winrt::IInspectable oldContent = args.OldValue(); + const winrt::IInspectable newContent = args.NewValue(); + UpdateContent(safe_cast(oldContent), safe_cast(newContent)); } else if (dependencyProperty == s_BackgroundProperty) { @@ -3365,13 +3365,13 @@ void Scroller::OnPropertyChanged( } } -void Scroller::OnChildPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args) +void Scroller::OnContentPropertyChanged(const winrt::DependencyObject& /*sender*/, const winrt::DependencyProperty& args) { SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this); - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (child) + if (content) { if (args == winrt::FrameworkElement::HorizontalAlignmentProperty() || args == winrt::FrameworkElement::VerticalAlignmentProperty()) @@ -3383,7 +3383,7 @@ void Scroller::OnChildPropertyChanged(const winrt::DependencyObject& /*sender*/, { if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation) { - SetupPositionBoundariesExpressionAnimations(child); + SetupPositionBoundariesExpressionAnimations(content); } const bool useTranslationProperty = IsVisualTranslationPropertyAvailable(); @@ -3391,7 +3391,7 @@ void Scroller::OnChildPropertyChanged(const winrt::DependencyObject& /*sender*/, if ((!useTranslationProperty && m_transformMatrixTranslateXExpressionAnimation && m_transformMatrixTranslateYExpressionAnimation && m_transformMatrixZoomFactorExpressionAnimation) || (useTranslationProperty && m_translationExpressionAnimation && m_zoomFactorExpressionAnimation)) { - SetupTransformExpressionAnimations(child); + SetupTransformExpressionAnimations(content); } } } @@ -3500,9 +3500,9 @@ void Scroller::OnLoaded( } } - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (child) + if (content) { const bool useTranslationProperty = IsVisualTranslationPropertyAvailable(); @@ -3510,7 +3510,7 @@ void Scroller::OnLoaded( ((!m_translationExpressionAnimation || !m_zoomFactorExpressionAnimation) && useTranslationProperty)) { EnsureTransformExpressionAnimations(); - SetupTransformExpressionAnimations(child); + SetupTransformExpressionAnimations(content); } // Process the potentially delayed operation in the OnCompositionTargetRendering handler. @@ -3542,11 +3542,11 @@ void Scroller::OnUnloaded( // Unhook the potential OnCompositionTargetRendering handler since there are no pending operations. UnhookCompositionTargetRendering(); - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); UpdateUnzoomedExtentAndViewport( - child ? m_unzoomedExtentWidth : 0.0, - child ? m_unzoomedExtentHeight : 0.0, + content ? m_unzoomedExtentWidth : 0.0, + content ? m_unzoomedExtentHeight : 0.0, 0.0 /*viewportWidth*/, 0.0 /*viewportHeight*/); } } @@ -3678,7 +3678,7 @@ void Scroller::OnPointerWheelChangedHandler( winrt::IInspectable inertiaDecayRateAsInsp = box_value(mouseWheelInertiaDecayRate); winrt::IReference inertiaDecayRate = inertiaDecayRateAsInsp.as>(); - winrt::float2 centerPoint = ComputeCenterPointerForMouseWheelZooming(Child(), pointerPoint.Position()); + winrt::float2 centerPoint = ComputeCenterPointerForMouseWheelZooming(Content(), pointerPoint.Position()); auto options = winrt::make_self( additionalVelocity, @@ -3713,13 +3713,13 @@ void Scroller::OnBringIntoViewRequestedHandler( args.HorizontalOffset(), args.VerticalOffset(), TypeLogging::RectToString(args.TargetRect()).c_str(), args.TargetElement()); - winrt::UIElement child = Child(); + winrt::UIElement content = Content(); if (SharedHelpers::IsTH2OrLower() || args.Handled() || args.TargetElement() == static_cast(*this) || - (args.TargetElement() == child && child.Visibility() == winrt::Visibility::Collapsed) || - !SharedHelpers::IsAncestor(args.TargetElement(), child, true /*checkVisibility*/)) + (args.TargetElement() == content && content.Visibility() == winrt::Visibility::Collapsed) || + !SharedHelpers::IsAncestor(args.TargetElement(), content, true /*checkVisibility*/)) { // Ignore the request when: // - There is no InteractionTracker to fulfill it. @@ -3738,7 +3738,7 @@ void Scroller::OnBringIntoViewRequestedHandler( // Compute the target offsets based on the provided BringIntoViewRequestedEventArgs. ComputeBringIntoViewTargetOffsets( - child, + content, args, &targetZoomedHorizontalOffset, &targetZoomedVerticalOffset, @@ -3763,16 +3763,16 @@ void Scroller::OnBringIntoViewRequestedHandler( return; } - child = Child(); + content = Content(); - if (!child || + if (!content || args.Handled() || args.TargetElement() == static_cast(*this) || - (args.TargetElement() == child && child.Visibility() == winrt::Visibility::Collapsed) || - !SharedHelpers::IsAncestor(args.TargetElement(), child, true /*checkVisibility*/)) + (args.TargetElement() == content && content.Visibility() == winrt::Visibility::Collapsed) || + !SharedHelpers::IsAncestor(args.TargetElement(), content, true /*checkVisibility*/)) { // Again, ignore the request when: - // - There is no Child anymore. + // - There is no Content anymore. // - The request was handled already. // - The target element is this Scroller itself. A parent scroller may fulfill the request instead then. // - The target element is effectively collapsed within the Scroller. @@ -3781,7 +3781,7 @@ void Scroller::OnBringIntoViewRequestedHandler( // Re-evaluate the target offsets based on the potentially modified BringIntoViewRequestedEventArgs. ComputeBringIntoViewTargetOffsets( - child, + content, args, &targetZoomedHorizontalOffset, &targetZoomedVerticalOffset, @@ -3862,9 +3862,9 @@ void Scroller::OnPointerPressed( return; } - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (!child || + if (!content || (GetComputedScrollMode(ScrollerDimension::HorizontalScroll) == winrt::ScrollMode::Disabled && GetComputedScrollMode(ScrollerDimension::VerticalScroll) == winrt::ScrollMode::Disabled && ZoomMode() == winrt::ZoomMode::Disabled)) @@ -4384,65 +4384,64 @@ void Scroller::RegenerateSnapPointsSet(winrt::IVector(m_unzoomedExtentWidth)); - m_maxPositionExpressionAnimation.SetScalarParameter(L"childSizeX", static_cast(m_unzoomedExtentWidth)); - m_minPositionExpressionAnimation.SetScalarParameter(L"childSizeY", static_cast(m_unzoomedExtentHeight)); - m_maxPositionExpressionAnimation.SetScalarParameter(L"childSizeY", static_cast(m_unzoomedExtentHeight)); + m_minPositionExpressionAnimation.SetScalarParameter(L"contentSizeX", static_cast(m_unzoomedExtentWidth)); + m_maxPositionExpressionAnimation.SetScalarParameter(L"contentSizeX", static_cast(m_unzoomedExtentWidth)); + m_minPositionExpressionAnimation.SetScalarParameter(L"contentSizeY", static_cast(m_unzoomedExtentHeight)); + m_maxPositionExpressionAnimation.SetScalarParameter(L"contentSizeY", static_cast(m_unzoomedExtentHeight)); - m_minPositionExpressionAnimation.SetScalarParameter(L"childLayoutOffsetX", m_childLayoutOffsetX); - m_maxPositionExpressionAnimation.SetScalarParameter(L"childLayoutOffsetX", m_childLayoutOffsetX); - m_minPositionExpressionAnimation.SetScalarParameter(L"childLayoutOffsetY", m_childLayoutOffsetY); - m_maxPositionExpressionAnimation.SetScalarParameter(L"childLayoutOffsetY", m_childLayoutOffsetY); + m_minPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetX", m_contentLayoutOffsetX); + m_maxPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetX", m_contentLayoutOffsetX); + m_minPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetY", m_contentLayoutOffsetY); + m_maxPositionExpressionAnimation.SetScalarParameter(L"contentLayoutOffsetY", m_contentLayoutOffsetY); m_interactionTracker.StartAnimation(L"MinPosition", m_minPositionExpressionAnimation); m_interactionTracker.StartAnimation(L"MaxPosition", m_maxPositionExpressionAnimation); @@ -4511,15 +4510,15 @@ void Scroller::UpdatePositionBoundaries( } void Scroller::UpdateTransformSource( - const winrt::UIElement& oldChild, - const winrt::UIElement& newChild) + const winrt::UIElement& oldContent, + const winrt::UIElement& newContent) { MUX_ASSERT((m_transformMatrixTranslateXExpressionAnimation && m_transformMatrixTranslateYExpressionAnimation && m_transformMatrixZoomFactorExpressionAnimation && !IsVisualTranslationPropertyAvailable()) || (m_translationExpressionAnimation && m_zoomFactorExpressionAnimation && IsVisualTranslationPropertyAvailable())); MUX_ASSERT(m_interactionTracker); - StopTransformExpressionAnimations(oldChild); - StartTransformExpressionAnimations(newChild); + StopTransformExpressionAnimations(oldContent); + StartTransformExpressionAnimations(newContent); } void Scroller::UpdateState( @@ -4550,7 +4549,7 @@ void Scroller::UpdateUnzoomedExtentAndViewport( SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"viewportWidth", viewportWidth); SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_DBL, METH_NAME, this, L"viewportHeight", viewportHeight); - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); const winrt::UIElement thisAsUIE = *this; const double oldUnzoomedExtentWidth = m_unzoomedExtentWidth; const double oldUnzoomedExtentHeight = m_unzoomedExtentHeight; @@ -4569,8 +4568,8 @@ void Scroller::UpdateUnzoomedExtentAndViewport( MUX_ASSERT(unzoomedExtentWidth >= 0.0); MUX_ASSERT(unzoomedExtentHeight >= 0.0); - MUX_ASSERT(!(!child && unzoomedExtentWidth != 0.0)); - MUX_ASSERT(!(!child && unzoomedExtentHeight != 0.0)); + MUX_ASSERT(!(!content && unzoomedExtentWidth != 0.0)); + MUX_ASSERT(!(!content && unzoomedExtentHeight != 0.0)); const bool horizontalExtentChanged = oldUnzoomedExtentWidth != unzoomedExtentWidth; const bool verticalExtentChanged = oldUnzoomedExtentHeight != unzoomedExtentHeight; @@ -4591,9 +4590,9 @@ void Scroller::UpdateUnzoomedExtentAndViewport( UpdateExpressionAnimationSources(); } - if (extentChanged && child) + if (extentChanged && content) { - OnChildSizeChanged(child); + OnContentSizeChanged(content); } if (extentChanged || viewportChanged) @@ -4758,13 +4757,13 @@ void Scroller::UpdateKeyEvents() } } -void Scroller::OnChildSizeChanged(const winrt::UIElement& child) +void Scroller::OnContentSizeChanged(const winrt::UIElement& content) { SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH, METH_NAME, this); if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation) { - UpdatePositionBoundaries(child); + UpdatePositionBoundaries(content); } const bool useTranslationProperty = IsVisualTranslationPropertyAvailable(); @@ -4773,7 +4772,7 @@ void Scroller::OnChildSizeChanged(const winrt::UIElement& child) ((!useTranslationProperty && m_transformMatrixTranslateXExpressionAnimation && m_transformMatrixTranslateYExpressionAnimation && m_transformMatrixZoomFactorExpressionAnimation) || (useTranslationProperty && m_translationExpressionAnimation && m_zoomFactorExpressionAnimation))) { - SetupTransformExpressionAnimations(child); + SetupTransformExpressionAnimations(content); } } @@ -4797,17 +4796,17 @@ void Scroller::OnViewChanged(bool horizontalOffsetChanged, bool verticalOffsetCh RaiseViewChanged(); } -void Scroller::OnChildLayoutOffsetChanged(ScrollerDimension dimension) +void Scroller::OnContentLayoutOffsetChanged(ScrollerDimension dimension) { MUX_ASSERT(dimension == ScrollerDimension::HorizontalScroll || dimension == ScrollerDimension::VerticalScroll); if (dimension == ScrollerDimension::HorizontalScroll) { - SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Horizontal", m_childLayoutOffsetX); + SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Horizontal", m_contentLayoutOffsetX); } else { - SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Vertical", m_childLayoutOffsetY); + SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_STR_FLT, METH_NAME, this, L"Vertical", m_contentLayoutOffsetY); } com_ptr globalTestHooks = ScrollerTestHooks::GetGlobalTestHooks(); @@ -4816,27 +4815,27 @@ void Scroller::OnChildLayoutOffsetChanged(ScrollerDimension dimension) { if (dimension == ScrollerDimension::HorizontalScroll) { - globalTestHooks->NotifyChildLayoutOffsetXChanged(*this); + globalTestHooks->NotifyContentLayoutOffsetXChanged(*this); } else { - globalTestHooks->NotifyChildLayoutOffsetYChanged(*this); + globalTestHooks->NotifyContentLayoutOffsetYChanged(*this); } } if (m_minPositionExpressionAnimation && m_maxPositionExpressionAnimation) { - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (child) + if (content) { - UpdatePositionBoundaries(child); + UpdatePositionBoundaries(content); } } if (m_expressionAnimationSources) { - m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_childLayoutOffsetX, m_childLayoutOffsetY }); + m_expressionAnimationSources.InsertVector2(s_offsetSourcePropertyName, { m_contentLayoutOffsetX, m_contentLayoutOffsetY }); } if (SharedHelpers::IsRS2OrHigher() && m_scrollerVisualInteractionSource) @@ -4907,9 +4906,9 @@ void Scroller::ChangeOffsetsPrivate( } } - if (!Child()) + if (!Content()) { - // When there is no child, skip the view change request and return -1, indicating that no action was taken. + // When there is no content, skip the view change request and return -1, indicating that no action was taken. return; } @@ -5017,9 +5016,9 @@ void Scroller::ChangeOffsetsWithAdditionalVelocityPrivate( *viewChangeId = -1; } - if (!Child()) + if (!Content()) { - // When there is no child, skip the view change request and return -1, indicating that no action was taken. + // When there is no content, skip the view change request and return -1, indicating that no action was taken. return; } @@ -5082,9 +5081,9 @@ void Scroller::ChangeZoomFactorPrivate( *viewChangeId = -1; } - if (!Child()) + if (!Content()) { - // When there is no child, skip the view change request and return -1, indicating that no action was taken. + // When there is no content, skip the view change request and return -1, indicating that no action was taken. return; } @@ -5201,9 +5200,9 @@ void Scroller::ChangeZoomFactorWithAdditionalVelocityPrivate( *viewChangeId = -1; } - if (!Child()) + if (!Content()) { - // When there is no child, skip the view change request and return -1, indicating that no action was taken. + // When there is no content, skip the view change request and return -1, indicating that no action was taken. return; } @@ -5472,7 +5471,7 @@ void Scroller::ProcessZoomFactorChange( float zoomFactor = options.ZoomFactor(); winrt::float2 centerPoint2D = options.CenterPoint(); - winrt::float3 centerPoint(centerPoint2D.x - m_childLayoutOffsetX, centerPoint2D.y - m_childLayoutOffsetY, 0.0f); + winrt::float3 centerPoint(centerPoint2D.x - m_contentLayoutOffsetX, centerPoint2D.y - m_contentLayoutOffsetY, 0.0f); switch (options.ZoomFactorKind()) { @@ -5530,7 +5529,7 @@ void Scroller::ProcessZoomFactorChange( float additionalVelocity = options.AdditionalVelocity(); winrt::IReference inertiaDecayRate = options.InertiaDecayRate(); winrt::float2 centerPoint2D = options.CenterPoint(); - winrt::float3 centerPoint(centerPoint2D.x - m_childLayoutOffsetX, centerPoint2D.y - m_childLayoutOffsetY, 0.0f); + winrt::float3 centerPoint(centerPoint2D.x - m_contentLayoutOffsetX, centerPoint2D.y - m_contentLayoutOffsetY, 0.0f); if (inertiaDecayRate) { @@ -5997,47 +5996,47 @@ void Scroller::UnhookSnapPointsVectorChangedEvents() } } -void Scroller::HookChildPropertyChanged( - const winrt::UIElement& child) +void Scroller::HookContentPropertyChanged( + const winrt::UIElement& content) { - if (child) + if (content) { - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - if (m_childHorizontalAlignmentChangedToken.value == 0) + if (m_contentHorizontalAlignmentChangedToken.value == 0) { - m_childHorizontalAlignmentChangedToken.value = childAsFE.RegisterPropertyChangedCallback( - winrt::FrameworkElement::HorizontalAlignmentProperty(), { this, &Scroller::OnChildPropertyChanged }); + m_contentHorizontalAlignmentChangedToken.value = contentAsFE.RegisterPropertyChangedCallback( + winrt::FrameworkElement::HorizontalAlignmentProperty(), { this, &Scroller::OnContentPropertyChanged }); } - if (m_childVerticalAlignmentChangedToken.value == 0) + if (m_contentVerticalAlignmentChangedToken.value == 0) { - m_childVerticalAlignmentChangedToken.value = childAsFE.RegisterPropertyChangedCallback( - winrt::FrameworkElement::VerticalAlignmentProperty(), { this, &Scroller::OnChildPropertyChanged }); + m_contentVerticalAlignmentChangedToken.value = contentAsFE.RegisterPropertyChangedCallback( + winrt::FrameworkElement::VerticalAlignmentProperty(), { this, &Scroller::OnContentPropertyChanged }); } } } } -void Scroller::UnhookChildPropertyChanged( - const winrt::UIElement& child) +void Scroller::UnhookContentPropertyChanged( + const winrt::UIElement& content) { - if (child) + if (content) { - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); - if (childAsFE) + if (contentAsFE) { - if (m_childHorizontalAlignmentChangedToken.value != 0) + if (m_contentHorizontalAlignmentChangedToken.value != 0) { - childAsFE.UnregisterPropertyChangedCallback(winrt::FrameworkElement::HorizontalAlignmentProperty(), m_childHorizontalAlignmentChangedToken.value); - m_childHorizontalAlignmentChangedToken.value = 0; + contentAsFE.UnregisterPropertyChangedCallback(winrt::FrameworkElement::HorizontalAlignmentProperty(), m_contentHorizontalAlignmentChangedToken.value); + m_contentHorizontalAlignmentChangedToken.value = 0; } - if (m_childVerticalAlignmentChangedToken.value != 0) + if (m_contentVerticalAlignmentChangedToken.value != 0) { - childAsFE.UnregisterPropertyChangedCallback(winrt::FrameworkElement::VerticalAlignmentProperty(), m_childVerticalAlignmentChangedToken.value); - m_childVerticalAlignmentChangedToken.value = 0; + contentAsFE.UnregisterPropertyChangedCallback(winrt::FrameworkElement::VerticalAlignmentProperty(), m_contentVerticalAlignmentChangedToken.value); + m_contentVerticalAlignmentChangedToken.value = 0; } } } @@ -6409,39 +6408,39 @@ void Scroller::DumpMinMaxPositions() { MUX_ASSERT(m_interactionTracker); - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); - if (!child) + if (!content) { // Min/MaxPosition == (0, 0) return; } const winrt::Visual scrollerVisual = winrt::ElementCompositionPreview::GetElementVisual(*this); - const winrt::FrameworkElement childAsFE = child.try_as(); + const winrt::FrameworkElement contentAsFE = content.try_as(); float minPosX = 0.0f; float minPosY = 0.0f; float extentWidth = static_cast(m_unzoomedExtentWidth); float extentHeight = static_cast(m_unzoomedExtentHeight); - if (childAsFE) + if (contentAsFE) { - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { minPosX = std::min(0.0f, (extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x) / 2.0f); } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { minPosX = std::min(0.0f, extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x); } - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { minPosY = std::min(0.0f, (extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y) / 2.0f); } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { minPosY = std::min(0.0f, extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y); } @@ -6450,26 +6449,26 @@ void Scroller::DumpMinMaxPositions() float maxPosX = std::max(0.0f, extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x); float maxPosY = std::max(0.0f, extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y); - if (childAsFE) + if (contentAsFE) { - if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || - childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) + if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Center || + contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Stretch) { maxPosX = (extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x) >= 0 ? (extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x) : (extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x) / 2.0f; } - else if (childAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) + else if (contentAsFE.HorizontalAlignment() == winrt::HorizontalAlignment::Right) { maxPosX = extentWidth * m_interactionTracker.Scale() - scrollerVisual.Size().x; } - if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || - childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) + if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Center || + contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Stretch) { maxPosY = (extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y) >= 0 ? (extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y) : (extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y) / 2.0f; } - else if (childAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) + else if (contentAsFE.VerticalAlignment() == winrt::VerticalAlignment::Bottom) { maxPosY = extentHeight * m_interactionTracker.Scale() - scrollerVisual.Size().y; } @@ -6481,9 +6480,9 @@ void Scroller::DumpMinMaxPositions() winrt::hstring Scroller::DependencyPropertyToString(const winrt::IDependencyProperty& dependencyProperty) { - if (dependencyProperty == s_ChildProperty) + if (dependencyProperty == s_ContentProperty) { - return L"Child"; + return L"Content"; } else if (dependencyProperty == s_BackgroundProperty) { diff --git a/dev/Scroller/Scroller.h b/dev/Scroller/Scroller.h index 6eead22726..71b8406360 100644 --- a/dev/Scroller/Scroller.h +++ b/dev/Scroller/Scroller.h @@ -109,7 +109,7 @@ class Scroller : void ConfigurationChanged(winrt::event_token const& token); winrt::Rect GetRelativeViewport( - winrt::UIElement const& child); + winrt::UIElement const& content); #pragma endregion #pragma region IFrameworkElementOverridesHelper @@ -176,18 +176,18 @@ class Scroller : const winrt::UIElement& element); // Invoked by ScrollerTestHooks - float GetChildLayoutOffsetX() + float GetContentLayoutOffsetX() { - return m_childLayoutOffsetX; + return m_contentLayoutOffsetX; } - float GetChildLayoutOffsetY() + float GetContentLayoutOffsetY() { - return m_childLayoutOffsetY; + return m_contentLayoutOffsetY; } - void SetChildLayoutOffsetX(float childLayoutOffsetX); - void SetChildLayoutOffsetY(float childLayoutOffsetY); + void SetContentLayoutOffsetX(float contentLayoutOffsetX); + void SetContentLayoutOffsetY(float contentLayoutOffsetY); winrt::IVector GetConsolidatedSnapPoints(winrt::ScrollerSnapPointDimension dimension); @@ -195,7 +195,7 @@ class Scroller : void OnPropertyChanged( const winrt::DependencyPropertyChangedEventArgs& args); - void OnChildPropertyChanged( + void OnContentPropertyChanged( const winrt::DependencyObject& sender, const winrt::DependencyProperty& args); @@ -237,15 +237,15 @@ class Scroller : ZoomFactor }; - float ComputeChildLayoutOffsetDelta(ScrollerDimension dimension, float unzoomedDelta) const; + float ComputeContentLayoutOffsetDelta(ScrollerDimension dimension, float unzoomedDelta) const; float ComputeEndOfInertiaZoomFactor() const; winrt::float2 ComputeEndOfInertiaPosition(); void ComputeMinMaxPositions(float zoomFactor, _Out_opt_ winrt::float2* minPosition, _Out_opt_ winrt::float2* maxPosition); winrt::float2 ComputePositionFromOffsets(double zoomedHorizontalOffset, double zoomedVerticalOffset); double ComputeValueAfterSnapPoints(double value, const std::set& snapPoints); - winrt::float2 ComputeCenterPointerForMouseWheelZooming(const winrt::UIElement& child, const winrt::Point& pointerPosition) const; + winrt::float2 ComputeCenterPointerForMouseWheelZooming(const winrt::UIElement& content, const winrt::Point& pointerPosition) const; void ComputeBringIntoViewTargetOffsets( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::BringIntoViewRequestedEventArgs& requestEventArgs, _Out_ double* targetZoomedHorizontalOffset, _Out_ double* targetZoomedVerticalOffset, @@ -307,27 +307,27 @@ class Scroller : const winrt::VisualInteractionSource& visualInteractionSource, ScrollerDimension dimension); void SetupPositionBoundariesExpressionAnimations( - const winrt::UIElement& child); + const winrt::UIElement& content); void SetupTransformExpressionAnimations( - const winrt::UIElement& child); + const winrt::UIElement& content); void StartTransformExpressionAnimations( - const winrt::UIElement& child); + const winrt::UIElement& content); void StopTransformExpressionAnimations( - const winrt::UIElement& child); + const winrt::UIElement& content); void StartExpressionAnimationSourcesAnimations(); void StopExpressionAnimationSourcesAnimations(); void StartScrollControllerExpressionAnimationSourcesAnimations( ScrollerDimension dimension); void StopScrollControllerExpressionAnimationSourcesAnimations( ScrollerDimension dimension); - void UpdateChild( - const winrt::UIElement& oldChild, - const winrt::UIElement& newChild); + void UpdateContent( + const winrt::UIElement& oldContent, + const winrt::UIElement& newContent); void UpdatePositionBoundaries( - const winrt::UIElement& child); + const winrt::UIElement& content); void UpdateTransformSource( - const winrt::UIElement& oldChild, - const winrt::UIElement& newChild); + const winrt::UIElement& oldContent, + const winrt::UIElement& newContent); void UpdateState( const winrt::InteractionState& state); void UpdateExpressionAnimationSources(); @@ -340,10 +340,10 @@ class Scroller : void UpdateVisualInteractionSourceMode(ScrollerDimension dimension); void UpdateManipulationRedirectionMode(); void UpdateKeyEvents(); - void OnChildSizeChanged( - const winrt::UIElement& child); + void OnContentSizeChanged( + const winrt::UIElement& content); void OnViewChanged(bool horizontalOffsetChanged, bool verticalOffsetChanged); - void OnChildLayoutOffsetChanged(ScrollerDimension dimension); + void OnContentLayoutOffsetChanged(ScrollerDimension dimension); void ChangeOffsetsPrivate( InteractionTrackerAsyncOperationTrigger operationTrigger, @@ -418,24 +418,24 @@ class Scroller : double GetComputedMaxWidth( double defaultMaxWidth, - const winrt::FrameworkElement& child) const; + const winrt::FrameworkElement& content) const; double GetComputedMaxHeight( double defaultMaxHeight, - const winrt::FrameworkElement& child) const; + const winrt::FrameworkElement& content) const; winrt::float2 GetArrangeRenderSizesDelta( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMinPositionExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMinPositionXExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMinPositionYExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMaxPositionExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMaxPositionXExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::hstring GetMaxPositionYExpression( - const winrt::UIElement& child) const; + const winrt::UIElement& content) const; winrt::CompositionAnimation GetPositionAnimation( double zoomedHorizontalOffset, @@ -457,8 +457,8 @@ class Scroller : void HookCompositionTargetRendering(); void HookScrollerEvents(); - void HookChildPropertyChanged( - const winrt::UIElement& child); + void HookContentPropertyChanged( + const winrt::UIElement& content); void HookHorizontalScrollControllerEvents( const winrt::IScrollController& horizontalScrollController, bool hasInteractionVisual); @@ -466,8 +466,8 @@ class Scroller : const winrt::IScrollController& verticalScrollController, bool hasInteractionVisual); void UnhookCompositionTargetRendering(); - void UnhookChildPropertyChanged( - const winrt::UIElement& child); + void UnhookContentPropertyChanged( + const winrt::UIElement& content); void UnhookScrollerEvents(); void UnhookHorizontalScrollControllerEvents( const winrt::IScrollController& horizontalScrollController); @@ -600,7 +600,7 @@ class Scroller : void ProcessAnchorCandidate( const winrt::UIElement& anchorCandidate, - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::Rect& viewportAnchorBounds, double viewportAnchorPointHorizontalOffset, double viewportAnchorPointVerticalOffset, @@ -609,12 +609,12 @@ class Scroller : _Inout_ winrt::Rect* bestAnchorCandidateBounds) const; static winrt::Rect GetDescendantBounds( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::UIElement& descendant); static bool IsElementValidAnchor( const winrt::UIElement& element, - const winrt::UIElement& child); + const winrt::UIElement& content); #pragma endregion static winrt::InteractionChainingMode InteractionChainingModeFromChainingMode( @@ -639,7 +639,7 @@ class Scroller : double childEnd); static winrt::Rect GetDescendantBounds( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::UIElement& descendant, const winrt::Rect& descendantRect); @@ -658,8 +658,8 @@ class Scroller : winrt::float2 m_endOfInertiaPosition{ 0.0f, 0.0f }; float m_endOfInertiaZoomFactor{ 1.0f }; float m_zoomFactor{ 1.0f }; - float m_childLayoutOffsetX{ 0.0f }; - float m_childLayoutOffsetY{ 0.0f }; + float m_contentLayoutOffsetX{ 0.0f }; + float m_contentLayoutOffsetY{ 0.0f }; double m_zoomedHorizontalOffset{ 0.0 }; double m_zoomedVerticalOffset{ 0.0 }; double m_unzoomedExtentWidth{ 0.0 }; @@ -720,8 +720,8 @@ class Scroller : winrt::event_token m_unloadedToken{}; winrt::event_token m_bringIntoViewRequested{}; winrt::event_token m_pointerWheelChangedToken{}; - winrt::event_token m_childHorizontalAlignmentChangedToken{}; - winrt::event_token m_childVerticalAlignmentChangedToken{}; + winrt::event_token m_contentHorizontalAlignmentChangedToken{}; + winrt::event_token m_contentVerticalAlignmentChangedToken{}; winrt::event_token m_horizontalScrollControllerOffsetChangeRequestedToken{}; winrt::event_token m_horizontalScrollControllerOffsetChangeWithAdditionalVelocityRequestedToken{}; @@ -755,7 +755,7 @@ class Scroller : std::set m_sortedConsolidatedVerticalSnapPoints{}; std::set m_sortedConsolidatedZoomSnapPoints{}; - // Property names being targeted for the Scroller.Child's Visual. + // Property names being targeted for the Scroller.Content's Visual. // RedStone v1 case: static constexpr std::wstring_view s_transformMatrixTranslateXPropertyName{ L"TransformMatrix._41"sv }; static constexpr std::wstring_view s_transformMatrixTranslateYPropertyName{ L"TransformMatrix._42"sv }; diff --git a/dev/Scroller/ScrollerAnchoring.cpp b/dev/Scroller/ScrollerAnchoring.cpp index 1ccd5b23c3..c974d81c12 100644 --- a/dev/Scroller/ScrollerAnchoring.cpp +++ b/dev/Scroller/ScrollerAnchoring.cpp @@ -8,7 +8,7 @@ #include "DoubleUtil.h" #include "ScrollerTestHooks.h" -// Used when Scroller.IsAnchoredAtHorizontalExtent or Scroller.IsAnchoredAtVerticalExtent is True to determine whether the Child is scrolled to an edge. +// Used when Scroller.IsAnchoredAtHorizontalExtent or Scroller.IsAnchoredAtVerticalExtent is True to determine whether the Content is scrolled to an edge. // It is declared at an edge if it's within 1/10th of a pixel. const double c_edgeDetectionTolerance = 0.1; @@ -62,7 +62,7 @@ void Scroller::RaiseAnchorRequested() } // Computes the type of anchoring to perform, if any, based on Scroller.HorizontalAnchorRatio, Scroller.VerticalAnchorRatio, -// Scroller.IsAnchoredAtHorizontalExtent, Scroller.IsAnchoredAtVerticalExtent, the current offsets, zoomFactor, viewport size, child size and state. +// Scroller.IsAnchoredAtHorizontalExtent, Scroller.IsAnchoredAtVerticalExtent, the current offsets, zoomFactor, viewport size, content size and state. // When all 4 returned booleans are False, no element anchoring is performed, no far edge anchoring is performed. There may still be anchoring at near edges. void Scroller::IsAnchoring( _Out_ bool* isAnchoringElementHorizontally, @@ -89,7 +89,7 @@ void Scroller::IsAnchoring( // Bug 17523266: Scroller is not anchoring during mouse wheel if (!m_interactionTracker || m_state == winrt::InteractionState::Animation) { - // Skip calls to SetChildLayoutOffsetX / SetChildLayoutOffsetY when the InteractionTracker has not been set up yet, + // Skip calls to SetContentLayoutOffsetX / SetContentLayoutOffsetY when the InteractionTracker has not been set up yet, // or when it is performing a custom animation because if would result in a visual flicker. return; } @@ -151,8 +151,8 @@ void Scroller::IsAnchoring( } // Returns: -// - viewportAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor point within the Scroller.Child. NaN if there is no horizontal anchoring. -// - viewportAnchorPointVerticalOffset: unzoomed vertical offset of the anchor point within the Scroller.Child. NaN if there is no vertical anchoring. +// - viewportAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor point within the Scroller.Content. NaN if there is no horizontal anchoring. +// - viewportAnchorPointVerticalOffset: unzoomed vertical offset of the anchor point within the Scroller.Content. NaN if there is no vertical anchoring. void Scroller::ComputeViewportAnchorPoint( double viewportWidth, double viewportHeight, @@ -175,8 +175,8 @@ void Scroller::ComputeViewportAnchorPoint( } // Returns: -// - elementAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor element's anchor point within the Scroller.Child. NaN if there is no horizontal anchoring. -// - elementAnchorPointVerticalOffset: unzoomed vertical offset of the anchor element's point within the Scroller.Child. NaN if there is no vertical anchoring. +// - elementAnchorPointHorizontalOffset: unzoomed horizontal offset of the anchor element's anchor point within the Scroller.Content. NaN if there is no horizontal anchoring. +// - elementAnchorPointVerticalOffset: unzoomed vertical offset of the anchor element's point within the Scroller.Content. NaN if there is no vertical anchoring. void Scroller::ComputeElementAnchorPoint( bool isForPreArrange, _Out_ double* elementAnchorPointHorizontalOffset, @@ -189,7 +189,7 @@ void Scroller::ComputeElementAnchorPoint( if (m_anchorElement.get()) { - winrt::Rect anchorElementBounds = isForPreArrange ? m_anchorElementBounds : GetDescendantBounds(Child(), m_anchorElement.get()); + winrt::Rect anchorElementBounds = isForPreArrange ? m_anchorElementBounds : GetDescendantBounds(Content(), m_anchorElement.get()); ComputeAnchorPoint(anchorElementBounds, elementAnchorPointHorizontalOffset, elementAnchorPointVerticalOffset); @@ -336,7 +336,7 @@ void Scroller::EnsureAnchorElementSelection() auto anchorRequestedEventArgs = winrt::get_self(m_anchorRequestedEventArgs.get()); winrt::UIElement requestedAnchorElement{ nullptr }; winrt::IVector anchorCandidates{ nullptr }; - const winrt::UIElement child = Child(); + const winrt::UIElement content = Content(); if (anchorRequestedEventArgs) { @@ -347,7 +347,7 @@ void Scroller::EnsureAnchorElementSelection() if (requestedAnchorElement) { m_anchorElement.set(requestedAnchorElement); - m_anchorElementBounds = GetDescendantBounds(child, requestedAnchorElement); + m_anchorElementBounds = GetDescendantBounds(content, requestedAnchorElement); if (globalTestHooks && globalTestHooks->AreAnchorNotificationsRaised()) { @@ -369,7 +369,7 @@ void Scroller::EnsureAnchorElementSelection() static_cast(m_viewportHeight / m_zoomFactor) }; - MUX_ASSERT(child); + MUX_ASSERT(content); if (anchorCandidates) { @@ -377,7 +377,7 @@ void Scroller::EnsureAnchorElementSelection() { ProcessAnchorCandidate( anchorCandidate, - child, + content, viewportAnchorBounds, viewportAnchorPointHorizontalOffset, viewportAnchorPointVerticalOffset, @@ -394,7 +394,7 @@ void Scroller::EnsureAnchorElementSelection() ProcessAnchorCandidate( anchorCandidate, - child, + content, viewportAnchorBounds, viewportAnchorPointHorizontalOffset, viewportAnchorPointVerticalOffset, @@ -422,7 +422,7 @@ void Scroller::EnsureAnchorElementSelection() // and potentially updates the best candidate and its bounds. void Scroller::ProcessAnchorCandidate( const winrt::UIElement& anchorCandidate, - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::Rect& viewportAnchorBounds, double viewportAnchorPointHorizontalOffset, double viewportAnchorPointVerticalOffset, @@ -431,15 +431,15 @@ void Scroller::ProcessAnchorCandidate( _Inout_ winrt::Rect* bestAnchorCandidateBounds) const { MUX_ASSERT(anchorCandidate); - MUX_ASSERT(child); + MUX_ASSERT(content); - if (!IsElementValidAnchor(anchorCandidate, child)) + if (!IsElementValidAnchor(anchorCandidate, content)) { - // Ignore candidates that are collapsed or do not belong to the Child element and are not the Child itself. + // Ignore candidates that are collapsed or do not belong to the Content element and are not the Content itself. return; } - winrt::Rect anchorCandidateBounds = GetDescendantBounds(child, anchorCandidate); + winrt::Rect anchorCandidateBounds = GetDescendantBounds(content, anchorCandidate); if (!SharedHelpers::DoRectsIntersect(viewportAnchorBounds, anchorCandidateBounds)) { @@ -470,13 +470,13 @@ void Scroller::ProcessAnchorCandidate( } } -// Returns the bounds of a Scroller.Child descendant in respect to that child. +// Returns the bounds of a Scroller.Content descendant in respect to that content. winrt::Rect Scroller::GetDescendantBounds( - const winrt::UIElement& child, + const winrt::UIElement& content, const winrt::UIElement& descendant) { - MUX_ASSERT(child); - MUX_ASSERT(IsElementValidAnchor(descendant, child)); + MUX_ASSERT(content); + MUX_ASSERT(IsElementValidAnchor(descendant, content)); const winrt::FrameworkElement descendantAsFE = descendant.as(); const winrt::Rect descendantRect{ @@ -486,13 +486,13 @@ winrt::Rect Scroller::GetDescendantBounds( descendantAsFE ? static_cast(descendantAsFE.ActualHeight()) : 0.0f }; - return GetDescendantBounds(child, descendant, descendantRect); + return GetDescendantBounds(content, descendant, descendantRect); } -bool Scroller::IsElementValidAnchor(const winrt::UIElement& element, const winrt::UIElement& child) +bool Scroller::IsElementValidAnchor(const winrt::UIElement& element, const winrt::UIElement& content) { MUX_ASSERT(element); - MUX_ASSERT(child); + MUX_ASSERT(content); - return element.Visibility() == winrt::Visibility::Visible && (element == child || SharedHelpers::IsAncestor(element, child)); + return element.Visibility() == winrt::Visibility::Visible && (element == content || SharedHelpers::IsAncestor(element, content)); } diff --git a/dev/Scroller/ScrollerPrimitives.idl b/dev/Scroller/ScrollerPrimitives.idl index 8b067a580b..1df4b612fe 100644 --- a/dev/Scroller/ScrollerPrimitives.idl +++ b/dev/Scroller/ScrollerPrimitives.idl @@ -108,14 +108,14 @@ interface IScrollController [WUXC_VERSION_PREVIEW] [webhosthidden] -[contentproperty("Child")] +[contentproperty("Content")] [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)] unsealed runtimeclass Scroller : Windows.UI.Xaml.FrameworkElement { Scroller(); Windows.UI.Xaml.Media.Brush Background { get; set; }; - Windows.UI.Xaml.UIElement Child { get; set; }; + Windows.UI.Xaml.UIElement Content { get; set; }; Windows.UI.Composition.CompositionPropertySet ExpressionAnimationSources { get; }; Double HorizontalOffset { get; }; Double VerticalOffset { get; }; @@ -184,7 +184,7 @@ unsealed runtimeclass Scroller : Windows.UI.Xaml.FrameworkElement event Windows.Foundation.TypedEventHandler AnchorRequested; static Windows.UI.Xaml.DependencyProperty BackgroundProperty { get; }; - static Windows.UI.Xaml.DependencyProperty ChildProperty { get; }; + static Windows.UI.Xaml.DependencyProperty ContentProperty { get; }; static Windows.UI.Xaml.DependencyProperty IsChildAvailableWidthConstrainedProperty { get; }; static Windows.UI.Xaml.DependencyProperty IsChildAvailableHeightConstrainedProperty { get; }; static Windows.UI.Xaml.DependencyProperty HorizontalScrollChainingModeProperty { get; }; diff --git a/dev/Scroller/ScrollerPrivate.cpp b/dev/Scroller/ScrollerPrivate.cpp index 3816925f58..5ae0f60e45 100644 --- a/dev/Scroller/ScrollerPrivate.cpp +++ b/dev/Scroller/ScrollerPrivate.cpp @@ -51,12 +51,12 @@ winrt::Rect Scroller::GetRelativeViewport( winrt::UIElement const& child) { // The commented out code is expected to work but somehow the child.TransformToVisual(*this) - // transform returns unexpected values shortly after a Scroller.Child layout offset change. - // Bug 14999031 is tracking this issue. For now the m_childLayoutOffsetX/Y, m_zoomedHorizontalOffset, + // transform returns unexpected values shortly after a Scroller.Content layout offset change. + // Bug 14999031 is tracking this issue. For now the m_contentLayoutOffsetX/Y, m_zoomedHorizontalOffset, // m_zoomedVerticalOffset usage below mitigates the problem. //const winrt::GeneralTransform transform = child.TransformToVisual(*this); - const winrt::GeneralTransform transform = child.TransformToVisual(Child()); + const winrt::GeneralTransform transform = child.TransformToVisual(Content()); const winrt::Point elementOffset = transform.TransformPoint(winrt::Point{}); const float viewportWidth = static_cast(m_viewportWidth / m_zoomFactor); const float viewportHeight = static_cast(m_viewportHeight / m_zoomFactor); @@ -69,8 +69,8 @@ winrt::Rect Scroller::GetRelativeViewport( ComputeMinMaxPositions(m_zoomFactor, &minPosition, nullptr); - winrt::Rect result = { (minPosition.x - m_childLayoutOffsetX + static_cast(m_zoomedHorizontalOffset) - elementOffset.X) / m_zoomFactor, - (minPosition.y - m_childLayoutOffsetY + static_cast(m_zoomedVerticalOffset) - elementOffset.Y) / m_zoomFactor, + winrt::Rect result = { (minPosition.x - m_contentLayoutOffsetX + static_cast(m_zoomedHorizontalOffset) - elementOffset.X) / m_zoomFactor, + (minPosition.y - m_contentLayoutOffsetY + static_cast(m_zoomedVerticalOffset) - elementOffset.Y) / m_zoomFactor, viewportWidth, viewportHeight }; SCROLLER_TRACE_VERBOSE(*this, TRACE_MSG_METH_PTR_STR, METH_NAME, this, child, TypeLogging::RectToString(result).c_str()); diff --git a/dev/Scroller/TestUI/ScrollerDynamicPage.xaml b/dev/Scroller/TestUI/ScrollerDynamicPage.xaml index fbd270baa5..9f6cfd80f3 100644 --- a/dev/Scroller/TestUI/ScrollerDynamicPage.xaml +++ b/dev/Scroller/TestUI/ScrollerDynamicPage.xaml @@ -33,10 +33,10 @@ IsChecked="True" IsThreeState="False" Margin="2,0,0,0"/> - @@ -213,12 +213,12 @@ - + - + null Small Image Large Image @@ -299,7 +299,7 @@ - + @@ -328,11 +328,11 @@ - + - + Left Center Right @@ -340,8 +340,8 @@ - + Top Center Bottom @@ -349,79 +349,79 @@ - + System None - -