Skip to content

Commit

Permalink
Step #2: Replace IsChildAvailableWidthConstrained/IsChildAvailableHei…
Browse files Browse the repository at this point in the history
…ghtConstrained usage with ContentOrientation and remove them.
  • Loading branch information
RBrid committed Jan 22, 2019
1 parent cc1a998 commit 49b12f7
Show file tree
Hide file tree
Showing 31 changed files with 114 additions and 392 deletions.
8 changes: 0 additions & 8 deletions dev/Generated/MetadataSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,6 @@ public MetadataSummary()
NeedsPropChangedCallbackMetadata["Scroller.InputKind"] = true;
NeedsPropChangedCallbackMetadata["Scroller.IsAnchoredAtHorizontalExtent"] = true;
NeedsPropChangedCallbackMetadata["Scroller.IsAnchoredAtVerticalExtent"] = true;
NeedsPropChangedCallbackMetadata["Scroller.IsChildAvailableHeightConstrained"] = true;
NeedsPropChangedCallbackMetadata["Scroller.IsChildAvailableWidthConstrained"] = true;
NeedsPropChangedCallbackMetadata["Scroller.MaxZoomFactor"] = true;
PropValidationCallbackMetadata["Scroller.MaxZoomFactor"] = "ValidateZoomFactoryBoundary";
NeedsPropChangedCallbackMetadata["Scroller.MinZoomFactor"] = true;
Expand All @@ -480,8 +478,6 @@ public MetadataSummary()
DefaultValueMetadata["Scroller.InputKind"] = @"Scroller::s_defaultInputKind";
DefaultValueMetadata["Scroller.IsAnchoredAtHorizontalExtent"] = @"Scroller::s_defaultAnchorAtExtent";
DefaultValueMetadata["Scroller.IsAnchoredAtVerticalExtent"] = @"Scroller::s_defaultAnchorAtExtent";
DefaultValueMetadata["Scroller.IsChildAvailableHeightConstrained"] = @"Scroller::s_defaultIsChildAvailableHeightConstrained";
DefaultValueMetadata["Scroller.IsChildAvailableWidthConstrained"] = @"Scroller::s_defaultIsChildAvailableWidthConstrained";
DefaultValueMetadata["Scroller.MaxZoomFactor"] = @"Scroller::s_defaultMaxZoomFactor";
DefaultValueMetadata["Scroller.MinZoomFactor"] = @"Scroller::s_defaultMinZoomFactor";
DefaultValueMetadata["Scroller.VerticalAnchorRatio"] = @"Scroller::s_defaultAnchorRatio";
Expand Down Expand Up @@ -511,8 +507,6 @@ public MetadataSummary()
NeedsPropChangedCallbackMetadata["ScrollViewer.InputKind"] = true;
NeedsPropChangedCallbackMetadata["ScrollViewer.IsAnchoredAtHorizontalExtent"] = true;
NeedsPropChangedCallbackMetadata["ScrollViewer.IsAnchoredAtVerticalExtent"] = true;
NeedsPropChangedCallbackMetadata["ScrollViewer.IsChildAvailableHeightConstrained"] = true;
NeedsPropChangedCallbackMetadata["ScrollViewer.IsChildAvailableWidthConstrained"] = true;
NeedsPropChangedCallbackMetadata["ScrollViewer.MaxZoomFactor"] = true;
PropValidationCallbackMetadata["ScrollViewer.MaxZoomFactor"] = "ValidateZoomFactoryBoundary";
NeedsPropChangedCallbackMetadata["ScrollViewer.MinZoomFactor"] = true;
Expand Down Expand Up @@ -540,8 +534,6 @@ public MetadataSummary()
DefaultValueMetadata["ScrollViewer.InputKind"] = @"ScrollViewer::s_defaultInputKind";
DefaultValueMetadata["ScrollViewer.IsAnchoredAtHorizontalExtent"] = @"ScrollViewer::s_defaultAnchorAtExtent";
DefaultValueMetadata["ScrollViewer.IsAnchoredAtVerticalExtent"] = @"ScrollViewer::s_defaultAnchorAtExtent";
DefaultValueMetadata["ScrollViewer.IsChildAvailableHeightConstrained"] = @"ScrollViewer::s_defaultIsChildAvailableHeightConstrained";
DefaultValueMetadata["ScrollViewer.IsChildAvailableWidthConstrained"] = @"ScrollViewer::s_defaultIsChildAvailableWidthConstrained";
DefaultValueMetadata["ScrollViewer.MaxZoomFactor"] = @"ScrollViewer::s_defaultMaxZoomFactor";
DefaultValueMetadata["ScrollViewer.MinZoomFactor"] = @"ScrollViewer::s_defaultMinZoomFactor";
DefaultValueMetadata["ScrollViewer.VerticalAnchorRatio"] = @"ScrollViewer::s_defaultAnchorRatio";
Expand Down
46 changes: 0 additions & 46 deletions dev/Generated/ScrollViewer.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ GlobalDependencyProperty ScrollViewerProperties::s_HorizontalScrollRailingModePr
GlobalDependencyProperty ScrollViewerProperties::s_InputKindProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_IsAnchoredAtHorizontalExtentProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_IsAnchoredAtVerticalExtentProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_IsChildAvailableHeightConstrainedProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_IsChildAvailableWidthConstrainedProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_MaxZoomFactorProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_MinZoomFactorProperty{ nullptr };
GlobalDependencyProperty ScrollViewerProperties::s_ScrollerProperty{ nullptr };
Expand Down Expand Up @@ -193,28 +191,6 @@ void ScrollViewerProperties::EnsureProperties()
ValueHelper<bool>::BoxValueIfNecessary(ScrollViewer::s_defaultAnchorAtExtent),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_IsChildAvailableHeightConstrainedProperty)
{
s_IsChildAvailableHeightConstrainedProperty =
InitializeDependencyProperty(
L"IsChildAvailableHeightConstrained",
winrt::name_of<bool>(),
winrt::name_of<winrt::ScrollViewer>(),
false /* isAttached */,
ValueHelper<bool>::BoxValueIfNecessary(ScrollViewer::s_defaultIsChildAvailableHeightConstrained),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_IsChildAvailableWidthConstrainedProperty)
{
s_IsChildAvailableWidthConstrainedProperty =
InitializeDependencyProperty(
L"IsChildAvailableWidthConstrained",
winrt::name_of<bool>(),
winrt::name_of<winrt::ScrollViewer>(),
false /* isAttached */,
ValueHelper<bool>::BoxValueIfNecessary(ScrollViewer::s_defaultIsChildAvailableWidthConstrained),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_MaxZoomFactorProperty)
{
s_MaxZoomFactorProperty =
Expand Down Expand Up @@ -353,8 +329,6 @@ void ScrollViewerProperties::ClearProperties()
s_InputKindProperty = nullptr;
s_IsAnchoredAtHorizontalExtentProperty = nullptr;
s_IsAnchoredAtVerticalExtentProperty = nullptr;
s_IsChildAvailableHeightConstrainedProperty = nullptr;
s_IsChildAvailableWidthConstrainedProperty = nullptr;
s_MaxZoomFactorProperty = nullptr;
s_MinZoomFactorProperty = nullptr;
s_ScrollerProperty = nullptr;
Expand Down Expand Up @@ -541,26 +515,6 @@ bool ScrollViewerProperties::IsAnchoredAtVerticalExtent()
return ValueHelper<bool>::CastOrUnbox(static_cast<ScrollViewer*>(this)->GetValue(s_IsAnchoredAtVerticalExtentProperty));
}

void ScrollViewerProperties::IsChildAvailableHeightConstrained(bool value)
{
static_cast<ScrollViewer*>(this)->SetValue(s_IsChildAvailableHeightConstrainedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
}

bool ScrollViewerProperties::IsChildAvailableHeightConstrained()
{
return ValueHelper<bool>::CastOrUnbox(static_cast<ScrollViewer*>(this)->GetValue(s_IsChildAvailableHeightConstrainedProperty));
}

void ScrollViewerProperties::IsChildAvailableWidthConstrained(bool value)
{
static_cast<ScrollViewer*>(this)->SetValue(s_IsChildAvailableWidthConstrainedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
}

bool ScrollViewerProperties::IsChildAvailableWidthConstrained()
{
return ValueHelper<bool>::CastOrUnbox(static_cast<ScrollViewer*>(this)->GetValue(s_IsChildAvailableWidthConstrainedProperty));
}

void ScrollViewerProperties::MaxZoomFactor(double value)
{
static_cast<ScrollViewer*>(this)->ValidateZoomFactoryBoundary(value);
Expand Down
10 changes: 0 additions & 10 deletions dev/Generated/ScrollViewer.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ class ScrollViewerProperties
void IsAnchoredAtVerticalExtent(bool value);
bool IsAnchoredAtVerticalExtent();

void IsChildAvailableHeightConstrained(bool value);
bool IsChildAvailableHeightConstrained();

void IsChildAvailableWidthConstrained(bool value);
bool IsChildAvailableWidthConstrained();

void MaxZoomFactor(double value);
double MaxZoomFactor();

Expand Down Expand Up @@ -97,8 +91,6 @@ class ScrollViewerProperties
static winrt::DependencyProperty InputKindProperty() { return s_InputKindProperty; }
static winrt::DependencyProperty IsAnchoredAtHorizontalExtentProperty() { return s_IsAnchoredAtHorizontalExtentProperty; }
static winrt::DependencyProperty IsAnchoredAtVerticalExtentProperty() { return s_IsAnchoredAtVerticalExtentProperty; }
static winrt::DependencyProperty IsChildAvailableHeightConstrainedProperty() { return s_IsChildAvailableHeightConstrainedProperty; }
static winrt::DependencyProperty IsChildAvailableWidthConstrainedProperty() { return s_IsChildAvailableWidthConstrainedProperty; }
static winrt::DependencyProperty MaxZoomFactorProperty() { return s_MaxZoomFactorProperty; }
static winrt::DependencyProperty MinZoomFactorProperty() { return s_MinZoomFactorProperty; }
static winrt::DependencyProperty ScrollerProperty() { return s_ScrollerProperty; }
Expand All @@ -124,8 +116,6 @@ class ScrollViewerProperties
static GlobalDependencyProperty s_InputKindProperty;
static GlobalDependencyProperty s_IsAnchoredAtHorizontalExtentProperty;
static GlobalDependencyProperty s_IsAnchoredAtVerticalExtentProperty;
static GlobalDependencyProperty s_IsChildAvailableHeightConstrainedProperty;
static GlobalDependencyProperty s_IsChildAvailableWidthConstrainedProperty;
static GlobalDependencyProperty s_MaxZoomFactorProperty;
static GlobalDependencyProperty s_MinZoomFactorProperty;
static GlobalDependencyProperty s_ScrollerProperty;
Expand Down
46 changes: 0 additions & 46 deletions dev/Generated/Scroller.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ GlobalDependencyProperty ScrollerProperties::s_HorizontalScrollRailingModeProper
GlobalDependencyProperty ScrollerProperties::s_InputKindProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_IsAnchoredAtHorizontalExtentProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_IsAnchoredAtVerticalExtentProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_IsChildAvailableHeightConstrainedProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_IsChildAvailableWidthConstrainedProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_MaxZoomFactorProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_MinZoomFactorProperty{ nullptr };
GlobalDependencyProperty ScrollerProperties::s_VerticalAnchorRatioProperty{ nullptr };
Expand Down Expand Up @@ -178,28 +176,6 @@ void ScrollerProperties::EnsureProperties()
ValueHelper<bool>::BoxValueIfNecessary(Scroller::s_defaultAnchorAtExtent),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_IsChildAvailableHeightConstrainedProperty)
{
s_IsChildAvailableHeightConstrainedProperty =
InitializeDependencyProperty(
L"IsChildAvailableHeightConstrained",
winrt::name_of<bool>(),
winrt::name_of<winrt::Scroller>(),
false /* isAttached */,
ValueHelper<bool>::BoxValueIfNecessary(Scroller::s_defaultIsChildAvailableHeightConstrained),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_IsChildAvailableWidthConstrainedProperty)
{
s_IsChildAvailableWidthConstrainedProperty =
InitializeDependencyProperty(
L"IsChildAvailableWidthConstrained",
winrt::name_of<bool>(),
winrt::name_of<winrt::Scroller>(),
false /* isAttached */,
ValueHelper<bool>::BoxValueIfNecessary(Scroller::s_defaultIsChildAvailableWidthConstrained),
winrt::PropertyChangedCallback(&OnPropertyChanged));
}
if (!s_MaxZoomFactorProperty)
{
s_MaxZoomFactorProperty =
Expand Down Expand Up @@ -304,8 +280,6 @@ void ScrollerProperties::ClearProperties()
s_InputKindProperty = nullptr;
s_IsAnchoredAtHorizontalExtentProperty = nullptr;
s_IsAnchoredAtVerticalExtentProperty = nullptr;
s_IsChildAvailableHeightConstrainedProperty = nullptr;
s_IsChildAvailableWidthConstrainedProperty = nullptr;
s_MaxZoomFactorProperty = nullptr;
s_MinZoomFactorProperty = nullptr;
s_VerticalAnchorRatioProperty = nullptr;
Expand Down Expand Up @@ -479,26 +453,6 @@ bool ScrollerProperties::IsAnchoredAtVerticalExtent()
return ValueHelper<bool>::CastOrUnbox(static_cast<Scroller*>(this)->GetValue(s_IsAnchoredAtVerticalExtentProperty));
}

void ScrollerProperties::IsChildAvailableHeightConstrained(bool value)
{
static_cast<Scroller*>(this)->SetValue(s_IsChildAvailableHeightConstrainedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
}

bool ScrollerProperties::IsChildAvailableHeightConstrained()
{
return ValueHelper<bool>::CastOrUnbox(static_cast<Scroller*>(this)->GetValue(s_IsChildAvailableHeightConstrainedProperty));
}

void ScrollerProperties::IsChildAvailableWidthConstrained(bool value)
{
static_cast<Scroller*>(this)->SetValue(s_IsChildAvailableWidthConstrainedProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
}

bool ScrollerProperties::IsChildAvailableWidthConstrained()
{
return ValueHelper<bool>::CastOrUnbox(static_cast<Scroller*>(this)->GetValue(s_IsChildAvailableWidthConstrainedProperty));
}

void ScrollerProperties::MaxZoomFactor(double value)
{
static_cast<Scroller*>(this)->ValidateZoomFactoryBoundary(value);
Expand Down
10 changes: 0 additions & 10 deletions dev/Generated/Scroller.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ class ScrollerProperties
void IsAnchoredAtVerticalExtent(bool value);
bool IsAnchoredAtVerticalExtent();

void IsChildAvailableHeightConstrained(bool value);
bool IsChildAvailableHeightConstrained();

void IsChildAvailableWidthConstrained(bool value);
bool IsChildAvailableWidthConstrained();

void MaxZoomFactor(double value);
double MaxZoomFactor();

Expand Down Expand Up @@ -87,8 +81,6 @@ class ScrollerProperties
static winrt::DependencyProperty InputKindProperty() { return s_InputKindProperty; }
static winrt::DependencyProperty IsAnchoredAtHorizontalExtentProperty() { return s_IsAnchoredAtHorizontalExtentProperty; }
static winrt::DependencyProperty IsAnchoredAtVerticalExtentProperty() { return s_IsAnchoredAtVerticalExtentProperty; }
static winrt::DependencyProperty IsChildAvailableHeightConstrainedProperty() { return s_IsChildAvailableHeightConstrainedProperty; }
static winrt::DependencyProperty IsChildAvailableWidthConstrainedProperty() { return s_IsChildAvailableWidthConstrainedProperty; }
static winrt::DependencyProperty MaxZoomFactorProperty() { return s_MaxZoomFactorProperty; }
static winrt::DependencyProperty MinZoomFactorProperty() { return s_MinZoomFactorProperty; }
static winrt::DependencyProperty VerticalAnchorRatioProperty() { return s_VerticalAnchorRatioProperty; }
Expand All @@ -110,8 +102,6 @@ class ScrollerProperties
static GlobalDependencyProperty s_InputKindProperty;
static GlobalDependencyProperty s_IsAnchoredAtHorizontalExtentProperty;
static GlobalDependencyProperty s_IsAnchoredAtVerticalExtentProperty;
static GlobalDependencyProperty s_IsChildAvailableHeightConstrainedProperty;
static GlobalDependencyProperty s_IsChildAvailableWidthConstrainedProperty;
static GlobalDependencyProperty s_MaxZoomFactorProperty;
static GlobalDependencyProperty s_MinZoomFactorProperty;
static GlobalDependencyProperty s_VerticalAnchorRatioProperty;
Expand Down
7 changes: 4 additions & 3 deletions dev/Repeater/APITests/EffectiveViewportScrollerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
using ScrollerViewChangeCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollerViewChangeCompletedEventArgs;
using ScrollerChangeOffsetsOptions = Microsoft.UI.Xaml.Controls.ScrollerChangeOffsetsOptions;
using ScrollerViewChangeKind = Microsoft.UI.Xaml.Controls.ScrollerViewChangeKind;
using ContentOrientation = Microsoft.UI.Xaml.Controls.ContentOrientation;
using ScrollerViewKind = Microsoft.UI.Xaml.Controls.ScrollerViewKind;
using ScrollerChangeZoomFactorOptions = Microsoft.UI.Xaml.Controls.ScrollerChangeZoomFactorOptions;
using IRepeaterScrollingSurface = Microsoft.UI.Private.Controls.IRepeaterScrollingSurface;
Expand Down Expand Up @@ -151,7 +152,7 @@ public void ValidateTwoScrollersScenario()
horizontalScroller = new Scroller
{
Child = repeater,
IsChildAvailableHeightConstrained = true
ContentOrientation = ContentOrientation.Horizontal
};

// Placing a Grid in between two Scroller controls to avoid
Expand All @@ -164,7 +165,7 @@ public void ValidateTwoScrollersScenario()
Child = grid,
Width = 200,
Height = 200,
IsChildAvailableWidthConstrained = true
ContentOrientation = ContentOrientation.Vertical
};

Content = verticalScroller;
Expand Down Expand Up @@ -335,7 +336,7 @@ public void CanBringIntoViewElements()
</DataTemplate>
</controls:RecyclingElementFactory>
</Grid.Resources>
<controls:Scroller x:Name='Scroller' Width='400' Height='600' IsChildAvailableWidthConstrained='True' Background='Gray'>
<controls:Scroller x:Name='Scroller' Width='400' Height='600' ContentOrientation='Vertical' Background='Gray'>
<controls:ItemsRepeater
x:Name='ItemsRepeater'
ItemTemplate='{StaticResource ElementFactory}'
Expand Down
19 changes: 13 additions & 6 deletions dev/Repeater/APITests/ViewportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
using ScrollerViewChangeCompletedEventArgs = Microsoft.UI.Xaml.Controls.ScrollerViewChangeCompletedEventArgs;
using ScrollerViewChangeSnapPointRespect = Microsoft.UI.Xaml.Controls.ScrollerViewChangeSnapPointRespect;
using ScrollerChangeOffsetsOptions = Microsoft.UI.Xaml.Controls.ScrollerChangeOffsetsOptions;
using ContentOrientation = Microsoft.UI.Xaml.Controls.ContentOrientation;
using ScrollerViewChangeKind = Microsoft.UI.Xaml.Controls.ScrollerViewChangeKind;
using ScrollerViewKind = Microsoft.UI.Xaml.Controls.ScrollerViewKind;
using ScrollerChangeZoomFactorOptions = Microsoft.UI.Xaml.Controls.ScrollerChangeZoomFactorOptions;
Expand Down Expand Up @@ -293,7 +294,7 @@ public void ValidateTwoScrollersScenario()
horizontalScroller = new Scroller
{
Child = repeater,
IsChildAvailableHeightConstrained = true
ContentOrientation = ContentOrientation.Horizontal
};

var grid = new Grid();
Expand All @@ -304,7 +305,7 @@ public void ValidateTwoScrollersScenario()
Child = grid,
Width = 200,
Height = 200,
IsChildAvailableWidthConstrained = true
ContentOrientation = ContentOrientation.Vertical
};

Content = verticalScroller;
Expand Down Expand Up @@ -395,8 +396,6 @@ public void ValidateSupportForScrollerConfigurationChanges()
scrollers[i] = new Scroller()
{
Child = grids[i],
IsChildAvailableWidthConstrained = true,
IsChildAvailableHeightConstrained = true
};
}

Expand Down Expand Up @@ -425,8 +424,16 @@ public void ValidateSupportForScrollerConfigurationChanges()
{
RunOnUIThread.Execute(() =>
{
scrollers[1].IsChildAvailableHeightConstrained = (scrollOrientation == ScrollOrientation.Horizontal);
scrollers[2].IsChildAvailableWidthConstrained = (scrollOrientation == ScrollOrientation.Vertical);
if (scrollOrientation == ScrollOrientation.Horizontal)
{
scrollers[1].ContentOrientation = ContentOrientation.Horizontal;
scrollers[2].ContentOrientation = ContentOrientation.None;
}
else
{
scrollers[1].ContentOrientation = ContentOrientation.None;
scrollers[2].ContentOrientation = ContentOrientation.Vertical;
}
});
IdleSynchronizer.Wait();

Expand Down
Loading

0 comments on commit 49b12f7

Please sign in to comment.