Skip to content
Permalink
Browse files

[Core, iOS, MacOS, Android, UWP, WPF] ListView hide scroll view scrol…

…l bars (#3897) fixes #3843

* Update from origin (#8)

* [C] VisibilityConverter Trims input (#3581)

For CSS purposes, the VisibilityConverter was added, and actually
replaced the `Boolean.Parse(str)` call for parsing Visibility.
`Boolean.Parse()` trims input, and the converter was not, so this was a
regression.
This changes Trim() the input, to be fully backward compatible.

- fixes #3554

* Ensure ConstructorCountId and TimeId elements are available before querying them (#3588)

* For consistency with ResourceDictionary, expose the Source for a StyleSheet (#2589)

This would allow previewer/designer/reloader to determine the source of a
stylesheet and refresh its content when appropriate.

* Revert "For consistency with ResourceDictionary, expose the Source for a StyleSheet (#2589)"

This reverts commit f66a72d.

* Fix NRE; Ret 0 if Text null (#3594) fixes #3579

* [UWP, WPF] Fixes rendering of the main page (#2896) fixes #2704

* [Core] Ignore Shamehat target when running DesignTimeBuild (#3605)

* [XamlC] Fix binding compilation fo value types (#3551)

properly load valuetype arguments of generated setters, using ldarg,
instead of ldarga.

- fixes #3539

* Update PULL_REQUEST_TEMPLATE.md

* Update PULL_REQUEST_TEMPLATE.md

* [Android] Fix Label LineHeight (#3452)

* fix line height android

* Make UAP respect initial LineHeight

* update .create-nuget.bat (#3638)

* Add Null Check to GetRenderer (#3575)

- fix #3563

* Fix 3562 Null Reference Exception (#3576)

- fixes #3562

* Fix 3564 Null Reference Exception (#3578)

- fixes #3564

* [iOS] AutomationProperty support for cells (#3313) fixes #3296

* [iOS] AutomationProperty support for cells

* Add test case to AutomationProperties gallery

* [UWP] Fix crash app when create navigation/tabbed page without children pages fixes #3188 (#3514)

* [Android] Use height when determining ScaledScreenSize; fixes #3609 (#3641)

* [C] Set binding context on Span Gestures (#3639)

* [Core] Set binding context on Span Gestures
* [Core] Simplify loop setting child binding context

- fixes #3524

* Update PULL_REQUEST_TEMPLATE.md

* [Android] remove deprecated AndroidUseLatestPlatformSdk (#3672)

* [iOS] iPad ActionSheet should always have a Cancel method (#3636)

* Add repro for #3049

* [iOS] iPad ActionSheet should always have a Cancel method

fixes #3049

* [Android] fixes #3675 - set  initial ScrollView Scroll values when RTL (#3676)

* [Android] API check for Shadow properties on Button (#3617) fixes #2702

* [Android] API check for Shadow properties on Button

* Fix swapped shadow values

* [iOS] fixes #3525 - add epsilon for float compare (#3654)

* [iOS] fixes #3525 - add epsilon for float compare and make region immutable

* [ControlGallery] spread out spans to account for click slop

* [ControlGallery] - adjust span slightly for android test

* [Core] remove private

* Fix text wrapping (#3671) fixes #3634

* [GTK] Fix navigation bar visibility updates (#3651)

* Fix partially  #3585 (#3592)

* Make webkit-sharp.dll.config cross-platform

* Update webkit-sharp.dll with missing signals bindings

see: https://github.com/ylatuya/webkit-sharp/tree/fluendo

* [iOS, UWP] fixes #2894 - Gestures collection changes weren't correctly propagating (#3643)

* [iOS, UWP] fixes #2894 - Gestures weren't wiring up to spans in all cases

* [Core] remove ChildGestureRecognizers when spans get removed

* [iOS] removed incorrect return from null

* Fixes #3663 (#3684)

* Fix ScrollView Padding issue (#3685)

* [WPF] Memory leak when you pop a TabbedPage (#3372) fixes #3267

* Fix [WPF] Memory leak when you pop a TabbedPage

* Update ViewRenderer.cs

* Update ViewRenderer.cs

* [Android,iOS,UWP] Allow Entry CursorPosition/SelectionLength to be set in ctor (#3402) fixes #3343 fixes #3633

* Add repro for #3343 + unit tests

* [Core] Disallow negative values for CursorPosition/SelectionLength

* [All] CursorPosition/SelectionLength can bindin ctor & clear value

fixes #3343

* typo

* cleanup

* [iOS] Cursor snaps to end

* try/catch

* [CSS] add more properties (#3466)

map new CSS properties:
- `color` on `IColorElement` (`ActivityIndicator`, `BoxView`),
  `ProgressBar` and `Switch`
- `row-gap` and `column-gap` on `Grid`
- `transform` and `transform-origin` on `VisualElement`
- `vertical-align` on `Label`

add new XF-specific CSS properties
- `-xf-placeholder` and `-xf-placeholder-color` on `Editor`, `Entry`,
  `SearchBar`
- `-xf-max-length` on `InputView` (`Editor` and `Entry`)
- `-xf-bar-background-color` and `-xf-bar-text-color` on
  `NavigationPage` and `TabbedPage`
- `-xf-orientation` on `ScrollView` and `StackLayout`
- `-xf-horizontal-scroll-bar-visibility` and
  `-xf-vertical-scroll-bar-visibility` on `ScrollView`
- `-xf-min-track-color`, `-xf-max-track-color` and `("-xf-thumb-color`
  on `Slider`
- `-xf-spacing` on `StackLayout`

This PR replaces and closes #3276

- fixes #2891

* [iOS] Specify a default size for UISearchBar width if needed (#3635) fixes #3413 fixes #2139

* [Controls] Add reproduction and test case for issue #3413

* [iOS] Don't use max value for iOS UISearchbar breaks on iOS 11.3

* [iOS] Force width value so we can renderer UISearchBar on iOS10 with infinite width

* [Controls] Fix spelling and add Manual Review to the test of #3413

* [iOS] Simplify code for UISearchBar width

* [iOS] Return always some width from measure the UISearchBar on IOS

* [Controls] Add reproduction case for issue #2139

* [UWP] Fixed double set margins in Layouts (#3570) fixes #3398 fixes #3616

* [Android] Support multiple clipping settings in single layout (#3559)

* Repro

* Fix for API 18+

*  [iOS] Unsubscribe CellPropertyChanged when SwitchCellRenderer is disposed (#3518)

* [Controls] Add repo of issue #3408

* [iOS] Unsubscribe CellPropertyChanged when cell is disposed

* [Controls] Add issue to project

* [iOS] Introduce CellPropertyChange to CellTableViewCell to used by all other cell renderers

* [Controls] Simplify Issue

* [iOS] Remove PropertyChanged that was not used

* [Controls] add check for null binding on template, add notes about issues

* [Controls] added reference to Android crash

* [iOS]Use existing PropertyChanged on ViewCelRenderer

* [iOS] Keep the existing override so we don't break users

* Update TextCellRenderer.cs

* update submodule

* 24H Mode (#3701)

The 24h mode for the pickerdialog was not working.

Version 3.1 was working fine. 

Here is an updated file.

* [UWP] uncomment tests that are now passing for 3188 (#3723)

* [UITest] Update Xamarin.UITest nuget package (#3632)

* [UITests] Update Xamarin.UITest 2.2.5

* [UITests] Try fix Toolbaritems

* [UITest] Update to 2.2.5-1606

* [UITests] Small Fixes and workarounds to make uitest happy

* [UITests ] Add delay to 1733 for API28

* [Android] Revert bad merge (#3746)

fixes #3705

* [Android, iOS] Fixes layout compression causes (#3698) fixes #3624

* [Android, iOS] Fixes layout compression causes

* [iOS] improve UpdateNewElement method

* Fix build error hopefully

* [UWP] Fixes CollectionChanged events in ListView (#3323)

* fixes #3273

* [UWP] Fixes CollectionChanged events in ListView

* a wrapped collection is used only if the SourceItem is not ObservableCollection

* improve uitest

* fixed NRE in empty ListView

* added a sortable custom renderer for UItest

* minor refactoring

* fixed reset of not wrapped collections

* addressing comments

* [UWP] remove WinRT hack

* [UWP] add missing using and cleanup additional resources

* [Android] Update Forms to remove API28 deprecated API (#3653) fixes #2128 fixes #3629

* [Build] Update provisioning

* [Controls] Ignore deprecated  Android API usage

* [Android] Remove use of obsolete color usage

* [Android] Remove app fragment usage

* [android] Rollback changes to EntryCellRenderer

* [Android] Better way to get the default color for the label text

* [Android] Obsolete message for ContentPage.CreateFragment()

* [ControlGallery] - create bitmap from Drawable to use for pixel location

* [Android] Use textcolor resource

* Update submodule

* Fix tests (#3771)

* [ControlGallery] Wait for element and add timing to tests

* [iOS] Fix NRE on RenderPool

* Add TabStop/TabIndex (#2795)

* [Core, UWP, Android] support TabStop/TabIndex

* removing linq

* add iOS / MacOS implementation

* add WPF implementation
fixes UWP implementation

* - addressing comments
- improve test
- optimizations
- added previous tab direction in same tab group

* addressing comments

* [Android] support tabstop for pickers

* - moving shared code to a static class
- removed reflection

* ITabStop -> changed to internal, renamed, added in to fastRenderers

* Update ITabStop to be public

* Fix : Binding Icon in ToolbarItem in TabbedPage doesn't refresh (#3761) fixes #3756

* [iOS] Fix NRE on ContextCell (#3714) fixes #3275

* [Controls] Add repo for issue #3275

* [iOS] Fix NRE when no gestures exist on table

* [iOS] Null check outside loop

* [iOS]Make sure to dispose/unhook when we are removed from UITableView.

* Update submodule

* [iOS] Don't double dispose ContextActionCell

* WPF - Fix Width and Height measurement when GetDesiredSize (#3750)

* WPF - Reset Width and Height when GetDesiredSize

* Some formatting changes

* Add APP directive

* [WPF]Fix build

* [Android Maps] Make markers available to subclasses (#3751)

* Make markers available to subclasses

* Fix build

* Use Find instead of FirstOrDefault

* [UITests] wait for element before querying for it (#3791)

* [UITests] wait for element before querying for it

* [Controls] generalize and better represent intended behavior

* WPF - Fix Local store not persistant when restarting App (#3752)

-fixes #3541
* WPF - Fix Local store not persistant when restarting App
* Add UITest
* [Controls] Add automated UI Test

* [UITests] Isolate test 3408

* [UITest] Update Xamarin UITest packages

* [UWP] implement Replace without reloading ListView (#3792)

-fixes #3788
* [UWP] implement Replace without reloading ListView
* [UWP] extract bindingcontext of new item for replace

* [iOS] Use UIApperance default color for UISwitch (#3819)

* [Controls] Set default color of UISwitch to Red

* [iOS] Use default color from Apperance API

* [UITests] replace awaits with more reliable WaitForElement (#3835)

* [Core] Propagate BindingContext changes to TitleView (#3823)

* [Core] Propagate BindingContext changes to TitleView

* [Tests] Move UI test to Core Unit Test

* [A] do not draw gradient for empty CornerRadius (#3786)

Drawing CornerRadius (introduce by #1998) when the CornerRadii are
actually 0 causes scaling artifacts on API < 25.

This fixes the regression when no CornerRadius is set. Expect blurry
border scaling with CornerRadius not empty and API < 25

- fixes #3781

* [Android] Fix WebView.Navigating event, make WebViewClient inheritable (#3780)

* Extracted WebViewRenderer.WebClient to FormsWebViewClient, moved SendNavigating call from ShouldOverrideUrlLoading to OnPageStarted

* Changed _webViewClient and GetWebViewClient() method to return base class

* Changed public things to protected internal

* Fix spaces to tabs indentation to match the coding style (#3745)

* [Build] Fix merge

* Fix #3097 swipe gesture not being handled in VisualElementTracker. (#3098) Fixes #3097

* Implemented for iOS, Android and MacOS

* Implemented UAP and WPF

* Refactored duplicate code and removed typo in method name

* Update from origin (#9)

* [C] VisibilityConverter Trims input (#3581)

For CSS purposes, the VisibilityConverter was added, and actually
replaced the `Boolean.Parse(str)` call for parsing Visibility.
`Boolean.Parse()` trims input, and the converter was not, so this was a
regression.
This changes Trim() the input, to be fully backward compatible.

- fixes #3554

* Ensure ConstructorCountId and TimeId elements are available before querying them (#3588)

* For consistency with ResourceDictionary, expose the Source for a StyleSheet (#2589)

This would allow previewer/designer/reloader to determine the source of a
stylesheet and refresh its content when appropriate.

* Revert "For consistency with ResourceDictionary, expose the Source for a StyleSheet (#2589)"

This reverts commit f66a72d.

* Fix NRE; Ret 0 if Text null (#3594) fixes #3579

* [UWP, WPF] Fixes rendering of the main page (#2896) fixes #2704

* [Core] Ignore Shamehat target when running DesignTimeBuild (#3605)

* [XamlC] Fix binding compilation fo value types (#3551)

properly load valuetype arguments of generated setters, using ldarg,
instead of ldarga.

- fixes #3539

* Update PULL_REQUEST_TEMPLATE.md

* Update PULL_REQUEST_TEMPLATE.md

* [Android] Fix Label LineHeight (#3452)

* fix line height android

* Make UAP respect initial LineHeight

* update .create-nuget.bat (#3638)

* Add Null Check to GetRenderer (#3575)

- fix #3563

* Fix 3562 Null Reference Exception (#3576)

- fixes #3562

* Fix 3564 Null Reference Exception (#3578)

- fixes #3564

* [iOS] AutomationProperty support for cells (#3313) fixes #3296

* [iOS] AutomationProperty support for cells

* Add test case to AutomationProperties gallery

* [UWP] Fix crash app when create navigation/tabbed page without children pages fixes #3188 (#3514)

* [Android] Use height when determining ScaledScreenSize; fixes #3609 (#3641)

* [C] Set binding context on Span Gestures (#3639)

* [Core] Set binding context on Span Gestures
* [Core] Simplify loop setting child binding context

- fixes #3524

* Update PULL_REQUEST_TEMPLATE.md

* [Android] remove deprecated AndroidUseLatestPlatformSdk (#3672)

* [iOS] iPad ActionSheet should always have a Cancel method (#3636)

* Add repro for #3049

* [iOS] iPad ActionSheet should always have a Cancel method

fixes #3049

* [Android] fixes #3675 - set  initial ScrollView Scroll values when RTL (#3676)

* [Android] API check for Shadow properties on Button (#3617) fixes #2702

* [Android] API check for Shadow properties on Button

* Fix swapped shadow values

* [iOS] fixes #3525 - add epsilon for float compare (#3654)

* [iOS] fixes #3525 - add epsilon for float compare and make region immutable

* [ControlGallery] spread out spans to account for click slop

* [ControlGallery] - adjust span slightly for android test

* [Core] remove private

* Fix text wrapping (#3671) fixes #3634

* [GTK] Fix navigation bar visibility updates (#3651)

* Fix partially  #3585 (#3592)

* Make webkit-sharp.dll.config cross-platform

* Update webkit-sharp.dll with missing signals bindings

see: https://github.com/ylatuya/webkit-sharp/tree/fluendo

* [iOS, UWP] fixes #2894 - Gestures collection changes weren't correctly propagating (#3643)

* [iOS, UWP] fixes #2894 - Gestures weren't wiring up to spans in all cases

* [Core] remove ChildGestureRecognizers when spans get removed

* [iOS] removed incorrect return from null

* Fixes #3663 (#3684)

* Fix ScrollView Padding issue (#3685)

* [WPF] Memory leak when you pop a TabbedPage (#3372) fixes #3267

* Fix [WPF] Memory leak when you pop a TabbedPage

* Update ViewRenderer.cs

* Update ViewRenderer.cs

* [Android,iOS,UWP] Allow Entry CursorPosition/SelectionLength to be set in ctor (#3402) fixes #3343 fixes #3633

* Add repro for #3343 + unit tests

* [Core] Disallow negative values for CursorPosition/SelectionLength

* [All] CursorPosition/SelectionLength can bindin ctor & clear value

fixes #3343

* typo

* cleanup

* [iOS] Cursor snaps to end

* try/catch

* [CSS] add more properties (#3466)

map new CSS properties:
- `color` on `IColorElement` (`ActivityIndicator`, `BoxView`),
  `ProgressBar` and `Switch`
- `row-gap` and `column-gap` on `Grid`
- `transform` and `transform-origin` on `VisualElement`
- `vertical-align` on `Label`

add new XF-specific CSS properties
- `-xf-placeholder` and `-xf-placeholder-color` on `Editor`, `Entry`,
  `SearchBar`
- `-xf-max-length` on `InputView` (`Editor` and `Entry`)
- `-xf-bar-background-color` and `-xf-bar-text-color` on
  `NavigationPage` and `TabbedPage`
- `-xf-orientation` on `ScrollView` and `StackLayout`
- `-xf-horizontal-scroll-bar-visibility` and
  `-xf-vertical-scroll-bar-visibility` on `ScrollView`
- `-xf-min-track-color`, `-xf-max-track-color` and `("-xf-thumb-color`
  on `Slider`
- `-xf-spacing` on `StackLayout`

This PR replaces and closes #3276

- fixes #2891

* [iOS] Specify a default size for UISearchBar width if needed (#3635) fixes #3413 fixes #2139

* [Controls] Add reproduction and test case for issue #3413

* [iOS] Don't use max value for iOS UISearchbar breaks on iOS 11.3

* [iOS] Force width value so we can renderer UISearchBar on iOS10 with infinite width

* [Controls] Fix spelling and add Manual Review to the test of #3413

* [iOS] Simplify code for UISearchBar width

* [iOS] Return always some width from measure the UISearchBar on IOS

* [Controls] Add reproduction case for issue #2139

* [UWP] Fixed double set margins in Layouts (#3570) fixes #3398 fixes #3616

* [Android] Support multiple clipping settings in single layout (#3559)

* Repro

* Fix for API 18+

*  [iOS] Unsubscribe CellPropertyChanged when SwitchCellRenderer is disposed (#3518)

* [Controls] Add repo of issue #3408

* [iOS] Unsubscribe CellPropertyChanged when cell is disposed

* [Controls] Add issue to project

* [iOS] Introduce CellPropertyChange to CellTableViewCell to used by all other cell renderers

* [Controls] Simplify Issue

* [iOS] Remove PropertyChanged that was not used

* [Controls] add check for null binding on template, add notes about issues

* [Controls] added reference to Android crash

* [iOS]Use existing PropertyChanged on ViewCelRenderer

* [iOS] Keep the existing override so we don't break users

* Update TextCellRenderer.cs

* update submodule

* 24H Mode (#3701)

The 24h mode for the pickerdialog was not working.

Version 3.1 was working fine. 

Here is an updated file.

* [UWP] uncomment tests that are now passing for 3188 (#3723)

* [UITest] Update Xamarin.UITest nuget package (#3632)

* [UITests] Update Xamarin.UITest 2.2.5

* [UITests] Try fix Toolbaritems

* [UITest] Update to 2.2.5-1606

* [UITests] Small Fixes and workarounds to make uitest happy

* [UITests ] Add delay to 1733 for API28

* [Android] Revert bad merge (#3746)

fixes #3705

* [Android, iOS] Fixes layout compression causes (#3698) fixes #3624

* [Android, iOS] Fixes layout compression causes

* [iOS] improve UpdateNewElement method

* Fix build error hopefully

* [UWP] Fixes CollectionChanged events in ListView (#3323)

* fixes #3273

* [UWP] Fixes CollectionChanged events in ListView

* a wrapped collection is used only if the SourceItem is not ObservableCollection

* improve uitest

* fixed NRE in empty ListView

* added a sortable custom renderer for UItest

* minor refactoring

* fixed reset of not wrapped collections

* addressing comments

* [UWP] remove WinRT hack

* [UWP] add missing using and cleanup additional resources

* [Android] Update Forms to remove API28 deprecated API (#3653) fixes #2128 fixes #3629

* [Build] Update provisioning

* [Controls] Ignore deprecated  Android API usage

* [Android] Remove use of obsolete color usage

* [Android] Remove app fragment usage

* [android] Rollback changes to EntryCellRenderer

* [Android] Better way to get the default color for the label text

* [Android] Obsolete message for ContentPage.CreateFragment()

* [ControlGallery] - create bitmap from Drawable to use for pixel location

* [Android] Use textcolor resource

* Update submodule

* Fix tests (#3771)

* [ControlGallery] Wait for element and add timing to tests

* [iOS] Fix NRE on RenderPool

* Add TabStop/TabIndex (#2795)

* [Core, UWP, Android] support TabStop/TabIndex

* removing linq

* add iOS / MacOS implementation

* add WPF implementation
fixes UWP implementation

* - addressing comments
- improve test
- optimizations
- added previous tab direction in same tab group

* addressing comments

* [Android] support tabstop for pickers

* - moving shared code to a static class
- removed reflection

* ITabStop -> changed to internal, renamed, added in to fastRenderers

* Update ITabStop to be public

* Fix : Binding Icon in ToolbarItem in TabbedPage doesn't refresh (#3761) fixes #3756

* [iOS] Fix NRE on ContextCell (#3714) fixes #3275

* [Controls] Add repo for issue #3275

* [iOS] Fix NRE when no gestures exist on table

* [iOS] Null check outside loop

* [iOS]Make sure to dispose/unhook when we are removed from UITableView.

* Update submodule

* [iOS] Don't double dispose ContextActionCell

* WPF - Fix Width and Height measurement when GetDesiredSize (#3750)

* WPF - Reset Width and Height when GetDesiredSize

* Some formatting changes

* Add APP directive

* [WPF]Fix build

* [Android Maps] Make markers available to subclasses (#3751)

* Make markers available to subclasses

* Fix build

* Use Find instead of FirstOrDefault

* [UITests] wait for element before querying for it (#3791)

* [UITests] wait for element before querying for it

* [Controls] generalize and better represent intended behavior

* WPF - Fix Local store not persistant when restarting App (#3752)

-fixes #3541
* WPF - Fix Local store not persistant when restarting App
* Add UITest
* [Controls] Add automated UI Test

* [UITests] Isolate test 3408

* [UITest] Update Xamarin UITest packages

* [UWP] implement Replace without reloading ListView (#3792)

-fixes #3788
* [UWP] implement Replace without reloading ListView
* [UWP] extract bindingcontext of new item for replace

* [iOS] Use UIApperance default color for UISwitch (#3819)

* [Controls] Set default color of UISwitch to Red

* [iOS] Use default color from Apperance API

* [UITests] replace awaits with more reliable WaitForElement (#3835)

* [Core] Propagate BindingContext changes to TitleView (#3823)

* [Core] Propagate BindingContext changes to TitleView

* [Tests] Move UI test to Core Unit Test

* [A] do not draw gradient for empty CornerRadius (#3786)

Drawing CornerRadius (introduce by #1998) when the CornerRadii are
actually 0 causes scaling artifacts on API < 25.

This fixes the regression when no CornerRadius is set. Expect blurry
border scaling with CornerRadius not empty and API < 25

- fixes #3781

* [Android] Fix WebView.Navigating event, make WebViewClient inheritable (#3780)

* Extracted WebViewRenderer.WebClient to FormsWebViewClient, moved SendNavigating call from ShouldOverrideUrlLoading to OnPageStarted

* Changed _webViewClient and GetWebViewClient() method to return base class

* Changed public things to protected internal

* Fix spaces to tabs indentation to match the coding style (#3745)

* [Build] Fix merge

* Fix #3097 swipe gesture not being handled in VisualElementTracker. (#3098) Fixes #3097

* Ensure that the ListViewAdapter is no longer being used by the ListVi… (#3848) fixes #3603

* Ensure that the ListViewAdapter is no longer being used by the ListView before disposing it

* Remove `RemoveAllViews` from `Dispose`

* Fixed code review comments

* Removed obsolete convert method

* Making sure default platform functionality is intact iOS and Android

As er code review comments

* Making sure default platform functionality is intact MacOS

* Making sure default platform functionality is intact UWP and WPF

* Code review comments for iOS, Android and MacOS

Default platform value is now preserved and applied when setting is set to default

* Code review comments UWP and WPF

* Fix build

* [UITest] - add ui test to test scroll permutations

* [Uwp] fix bad merge

* [wpf] fix spacing
  • Loading branch information...
jfversluis authored and rmarinho committed Oct 25, 2018
1 parent 7f661b5 commit a66b9bba6b292c03c4397aa02755408500ebd390
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;


#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 3843, "[Enhancement] Hide Scroll Bars on ListView")]
#if UITEST
[NUnit.Framework.Category(UITestCategories.ListView)]
#endif
public class Issue3843 : TestContentPage
{
protected override void Init()
{
ListView list = new ListView();
list.BackgroundColor = Color.Yellow;
list.ItemsSource =
Enumerable
.Range(0, 1000)
.Select(x=> String.Join("", Enumerable.Range(0,100)) )
.ToArray();

list.ItemTemplate = new DataTemplate(() =>
{
ViewCell cell = new ViewCell();

Label label = new Label();
label.LineBreakMode = LineBreakMode.NoWrap;
label.SetBinding(Label.TextProperty, ".");

cell.View = label;
return cell;
});

Label labelScrollBarState = new Label();
Content = new StackLayout()
{
Orientation = StackOrientation.Vertical,
Children =
{
new Label()
{
Text = "Click the buttons to toggle scrollbar visibility and validate they works"
},
labelScrollBarState,
list,
new Button()
{
Text = "Toggle Horizontal",
Command = new Command(() =>
{
switch(list.HorizontalScrollBarVisibility)
{
case ScrollBarVisibility.Always:
list.HorizontalScrollBarVisibility = ScrollBarVisibility.Default;
break;
case ScrollBarVisibility.Default:
list.HorizontalScrollBarVisibility = ScrollBarVisibility.Never;
break;
case ScrollBarVisibility.Never:
list.HorizontalScrollBarVisibility = ScrollBarVisibility.Always;
break;
}
UpdateScrollVisibility(list, labelScrollBarState);
})
},
new Button()
{
Text = "Toggle Vertical",
Command = new Command(() =>
{
switch(list.VerticalScrollBarVisibility)
{
case ScrollBarVisibility.Always:
list.VerticalScrollBarVisibility = ScrollBarVisibility.Default;
break;
case ScrollBarVisibility.Default:
list.VerticalScrollBarVisibility = ScrollBarVisibility.Never;
break;
case ScrollBarVisibility.Never:
list.VerticalScrollBarVisibility = ScrollBarVisibility.Always;
break;
}
UpdateScrollVisibility(list, labelScrollBarState);
})
},

}
};

UpdateScrollVisibility(list, labelScrollBarState);
}

void UpdateScrollVisibility(ListView listView, Label label)
{
label.Text = $"Horizontal: {listView.HorizontalScrollBarVisibility} Vertical: {listView.VerticalScrollBarVisibility}";
}

}
}
@@ -20,6 +20,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue3509.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Github3856.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1937.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3843.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue4053.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3809.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue2894.cs" />
@@ -268,6 +268,14 @@ protected override void Build(StackLayout stackLayout)
fastScrollItemContainer.View.On<Android>().SetIsFastScrollEnabled(true);
fastScrollItemContainer.View.ItemsSource = viewModel.CategorizedEmployees;

var scrollbarVisibilityContainer = new ViewContainer<ListView>(Test.ListView.ScrollBarVisibility, new ListView());
InitializeElement(scrollbarVisibilityContainer.View);
scrollbarVisibilityContainer.View.HorizontalScrollBarVisibility = ScrollBarVisibility.Never;
scrollbarVisibilityContainer.View.VerticalScrollBarVisibility = ScrollBarVisibility.Never;
scrollbarVisibilityContainer.View.ItemsSource = viewModel.CategorizedEmployees;
scrollbarVisibilityContainer.View.IsGroupingEnabled = true;
scrollbarVisibilityContainer.View.GroupDisplayBinding = new Binding("Key");

Add(groupDisplayBindingContainer);
Add(groupHeaderTemplateContainer);
Add(groupShortNameContainer);
@@ -280,6 +288,7 @@ protected override void Build(StackLayout stackLayout)
Add(rowHeightContainer);
Add(selectedItemContainer);
Add(fastScrollItemContainer);
Add(scrollbarVisibilityContainer);
}
}
}
@@ -46,6 +46,10 @@ public class ListView : ItemsView<Cell>, IListViewController, IElementConfigurat

public static readonly BindableProperty SeparatorColorProperty = BindableProperty.Create("SeparatorColor", typeof(Color), typeof(ListView), Color.Default);

public static readonly BindableProperty HorizontalScrollBarVisibilityProperty = BindableProperty.Create(nameof(HorizontalScrollBarVisibility), typeof(ScrollBarVisibility), typeof(ListView), ScrollBarVisibility.Default);

public static readonly BindableProperty VerticalScrollBarVisibilityProperty = BindableProperty.Create(nameof(VerticalScrollBarVisibility), typeof(ScrollBarVisibility), typeof(ListView), ScrollBarVisibility.Default);

readonly Lazy<PlatformConfigurationRegistry<ListView>> _platformConfigurationRegistry;

BindingBase _groupDisplayBinding;
@@ -223,6 +227,17 @@ public SeparatorVisibility SeparatorVisibility
set { SetValue(SeparatorVisibilityProperty, value); }
}

public ScrollBarVisibility HorizontalScrollBarVisibility
{
get { return (ScrollBarVisibility)GetValue(HorizontalScrollBarVisibilityProperty); }
set { SetValue(HorizontalScrollBarVisibilityProperty, value); }
}
public ScrollBarVisibility VerticalScrollBarVisibility
{
get { return (ScrollBarVisibility)GetValue(VerticalScrollBarVisibilityProperty); }
set { SetValue(VerticalScrollBarVisibilityProperty, value); }
}

[EditorBrowsable(EditorBrowsableState.Never)]
public ListViewCachingStrategy CachingStrategy { get; private set; }

@@ -429,7 +429,8 @@ public enum ListView
GroupDisplayBinding,
GroupShortNameBinding,
ScrollTo,
FastScroll
FastScroll,
ScrollBarVisibility
}

public enum TableView
@@ -27,6 +27,9 @@ public class ListViewRenderer : ViewRenderer<ListView, AListView>, SwipeRefreshL
IListViewController Controller => Element;
ITemplatedItemsView<Cell> TemplatedItemsView => Element;

ScrollBarVisibility _defaultHorizontalScrollVisibility = 0;
ScrollBarVisibility _defaultVerticalScrollVisibility = 0;

public ListViewRenderer(Context context) : base(context)
{
AutoPackage = false;
@@ -175,6 +178,8 @@ protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
UpdateIsSwipeToRefreshEnabled();
UpdateFastScrollEnabled();
UpdateSelectionMode();
UpdateHorizontalScrollBarVisibility();
UpdateVerticalScrollBarVisibility();
}
}

@@ -212,6 +217,10 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
UpdateFastScrollEnabled();
else if (e.PropertyName == ListView.SelectionModeProperty.PropertyName)
UpdateSelectionMode();
else if (e.PropertyName == ScrollView.HorizontalScrollBarVisibilityProperty.PropertyName)
UpdateHorizontalScrollBarVisibility();
else if (e.PropertyName == ScrollView.VerticalScrollBarVisibilityProperty.PropertyName)
UpdateVerticalScrollBarVisibility();
}

protected override void OnLayout(bool changed, int l, int t, int r, int b)
@@ -410,6 +419,36 @@ void UpdateSelectionMode()
}
}

void UpdateHorizontalScrollBarVisibility()
{
if (_defaultHorizontalScrollVisibility == 0)
{
_defaultHorizontalScrollVisibility = Control.HorizontalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;
}

var newHorizontalScrollVisiblility = Element.HorizontalScrollBarVisibility;

if (newHorizontalScrollVisiblility == ScrollBarVisibility.Default)
{
newHorizontalScrollVisiblility = _defaultHorizontalScrollVisibility;
}

Control.HorizontalScrollBarEnabled = newHorizontalScrollVisiblility == ScrollBarVisibility.Always;
}

void UpdateVerticalScrollBarVisibility()
{
if (_defaultVerticalScrollVisibility == 0)
_defaultVerticalScrollVisibility = Control.VerticalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;

var newVerticalScrollVisibility = Element.VerticalScrollBarVisibility;

if (newVerticalScrollVisibility == ScrollBarVisibility.Default)
newVerticalScrollVisibility = _defaultVerticalScrollVisibility;

Control.VerticalScrollBarEnabled = newVerticalScrollVisibility == ScrollBarVisibility.Always;
}

internal class Container : ViewGroup
{
IVisualElementRenderer _child;
@@ -18,6 +18,9 @@ public class ListViewRenderer : ViewRenderer<ListView, NSView>

ITemplatedItemsView<Cell> TemplatedItemsView => Element;

bool? _defaultHorizontalScrollVisibility;
bool? _defaultVerticalScrollVisibility;

public const int DefaultRowHeight = 44;

public NSTableView NativeTableView => _table;
@@ -124,6 +127,8 @@ protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
UpdateIsRefreshing();
UpdateSeparatorColor();
UpdateSeparatorVisibility();
UpdateVerticalScrollBarVisibility();
UpdateHorizontalScrollBarVisibility();

var selected = e.NewElement.SelectedItem;
if (selected != null)
@@ -155,6 +160,10 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
UpdateFooter();
else if (e.PropertyName == "RefreshAllowed")
UpdatePullToRefreshEnabled();
else if (e.PropertyName == ScrollView.VerticalScrollBarVisibilityProperty.PropertyName)
UpdateVerticalScrollBarVisibility();
else if (e.PropertyName == ScrollView.HorizontalScrollBarVisibilityProperty.PropertyName)
UpdateHorizontalScrollBarVisibility();
}

void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
@@ -325,6 +334,50 @@ void UpdateFooter()
{
}

void UpdateVerticalScrollBarVisibility()
{
if (_table?.EnclosingScrollView != null)
{
if (_defaultVerticalScrollVisibility == null)
_defaultVerticalScrollVisibility = _table.EnclosingScrollView.HasVerticalScroller;

switch (Element.VerticalScrollBarVisibility)
{
case (ScrollBarVisibility.Always):
_table.EnclosingScrollView.HasVerticalScroller = true;
break;
case (ScrollBarVisibility.Never):
_table.EnclosingScrollView.HasVerticalScroller = false;
break;
case (ScrollBarVisibility.Default):
_table.EnclosingScrollView.HasVerticalScroller = (bool)_defaultVerticalScrollVisibility;
break;
}
}
}

void UpdateHorizontalScrollBarVisibility()
{
if (_table?.EnclosingScrollView != null)
{
if (_defaultHorizontalScrollVisibility == null)
_defaultHorizontalScrollVisibility = _table.EnclosingScrollView.HasHorizontalScroller;

switch (Element.HorizontalScrollBarVisibility)
{
case (ScrollBarVisibility.Always):
_table.EnclosingScrollView.HasHorizontalScroller = true;
break;
case (ScrollBarVisibility.Never):
_table.EnclosingScrollView.HasHorizontalScroller = false;
break;
case (ScrollBarVisibility.Default):
_table.EnclosingScrollView.HasHorizontalScroller = (bool)_defaultHorizontalScrollVisibility;
break;
}
}
}

class FormsNSTableView : NSTableView
{
//NSTableView doesn't support selection notfications after the items is already selected
@@ -6,6 +6,7 @@
using Windows.UI.Xaml.Input;
using Xamarin.Forms.Internals;
using WImageSource = Windows.UI.Xaml.Media.ImageSource;
using UwpScrollBarVisibility = Windows.UI.Xaml.Controls.ScrollBarVisibility;

namespace Xamarin.Forms.Platform.UWP
{
@@ -53,7 +54,7 @@ public static async Task<WImageSource> ToWindowsImageSource(this ImageSource sou
}

internal static InputScopeNameValue GetKeyboardButtonType(this ReturnType returnType)
{
{
switch (returnType)
{
case ReturnType.Default:
@@ -84,6 +85,21 @@ internal static InputScope ToInputScope(this ReturnType returnType)
return inputScope;
}

internal static UwpScrollBarVisibility ToUwpScrollBarVisibility(this ScrollBarVisibility visibility)
{
switch (visibility)
{
case ScrollBarVisibility.Always:
return UwpScrollBarVisibility.Visible;
case ScrollBarVisibility.Default:
return UwpScrollBarVisibility.Auto;
case ScrollBarVisibility.Never:
return UwpScrollBarVisibility.Hidden;
default:
return UwpScrollBarVisibility.Auto;
}
}

public static T Clamp<T>(this T value, T min, T max) where T : IComparable<T>
{
if (value.CompareTo(min) < 0)
Oops, something went wrong.

0 comments on commit a66b9bb

Please sign in to comment.
You can’t perform that action at this time.