Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Enhancement] Expander control #9044

Merged
merged 13 commits into from
Apr 4, 2020
Merged

Conversation

AndreiMisiukevich
Copy link
Contributor

@AndreiMisiukevich AndreiMisiukevich commented Dec 29, 2019

Description of Change

Hi folks,
Currently, there is no expander control in the XF box.
Perhaps this control will be useful for many developers.

I tried to align API according to Windows Expander:
https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/expander

expander

API Changes

Added:

  • Expander control
public class Expander 
{
	public event EventHandler Tapped;

	public View Header { get; set; }

	public View Content { get; set; }

	public DataTemplate ContentTemplate { get; set; }

	public bool IsExpanded { get; set; }

	public uint ExpandAnimationLength { get; set; }

	public uint CollapseAnimationLength { get; set; }

	public Easing ExpandAnimationEasing { get; set; }

	public Easing CollapseAnimationEasing { get; set; }

	public ExpanderState State { get; set; }

	public object CommandParameter { get; set; }

	public ICommand Command { get; set; }

	public ICommand ForceUpdateSizeCommand { get; set; }

	public double Spacing { get; set; }
}

public enum ExpanderState
{
	Expanding,
	Expanded,
	Collapsing,
	Collapsed
}

So there are two approaches how to use Expander

  1. Content Lazy Initialization. In this case, we should use ContentTemplate
<Expander>
	<Expander.Header>
		<Label Text="Header" />
	</Expander.Header>

	<Expander.ContentTemplate>
		<DataTemplate>
		<!-- Content here -->
		<ContentView x:Name="content"/>
		</DataTemplate>
	</Expander.ContentTemplate>
</Expander>
  1. Non-lazy approach (for example if you need to set x:Name to the Content view.
<Expander>
	<Expander.Header>
		<Label Text="Header" />
	</Expander.Header>

         <!-- Content here -->
	<ContentView x:Name="content"/>
</Expander>

Platforms Affected

  • Core

Since this implementation is 100 percent cross-platform, the changes affect Core part only.

Testing Procedure

  • Run ControlGallery and navigate to the "Expander Gallery" via the search bar.
  • Play with the sample.

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very (very) first short sweep just one private keyword that isn't supposed to be there. I'll have another in-depth look tomorrow.

Thank you so much for your efforts Andrei! Especially this time of year!

Xamarin.Forms.Core/Expander.cs Outdated Show resolved Hide resolved
@acaliaro
Copy link

It's a "control" (like ListView or CollectionView) or is a View that you can use inside ListView or CollectionView (like SwipeView...)

@jfversluis
Copy link
Member

I've played around with it and it seems pretty solid.

The only thing I can't seem to figure out is how to use the Command on this. I've added the Command binding and tried to let all other Expanders close when one opens, I think that is something people would typically would want as well. But whatever I do, I can't seem to get the Command to fire. Is there something I am doing wrong?

@AndreiMisiukevich
Copy link
Contributor Author

Comman is invoked each time when user taps it)

@AndreiMisiukevich
Copy link
Contributor Author

You can observe IsExpanded property

@AndreiMisiukevich
Copy link
Contributor Author

@jfversluis Hey Gerald, need you more explanation? :)

Command and Tapped are invoked once a user taps over a header. Also, we change IsExpanded to the opposite value.

image

@jfversluis
Copy link
Member

But that is just the thing, it wasn't invoked when I tried it :) Did you try it? Does it work? If so, please show me how. Maybe you can add it to the sample?

@AndreiMisiukevich
Copy link
Contributor Author

@jfversluis yes, I can extend the sample.

@AndreiMisiukevich
Copy link
Contributor Author

@jfversluis check it please

@jfversluis
Copy link
Member

Yes! Awesome, thanks! Not sure why, the command just didn't seem to fire for me.

Just retried on both iOS and Android and seems to work fine. Thank you for that!

Any specific reason you didn't add any tests?

@AndreiMisiukevich
Copy link
Contributor Author

Yes! Awesome, thanks! Not sure why, the command just didn't seem to fire for me.

Just retried on both iOS and Android and seems to work fine. Thank you for that!

Any specific reason you didn't add any tests?

What kind of test do you mean? Unit or UI?

@samhouts samhouts added t/enhancement ➕ F100 API-change Heads-up to reviewers that this PR may contain an API change swipeview a/swipeview and removed swipeview a/swipeview labels Jan 8, 2020
@jfversluis
Copy link
Member

Ideally both! But I guess UI tests would make most sense for this :)

@AndreiMisiukevich
Copy link
Contributor Author

@jfversluis yes. Frankly speaking, I do not understand what can be covered by unit tests in this class.

As for UI tests, I tried to run them at least a half year ago but didn't work out it. (Tried on Mac).

Also, I have no experience in writing UI tests

@AndreiMisiukevich
Copy link
Contributor Author

@jfversluis I will appreciate your assistance in writing tests ;)

@jfversluis
Copy link
Member

Sorry, was still on my todo list! Could you reach out to gerald.versluis [weird email sign] microsoft.com. Let's see if we can get the tests to run on your machine short term. If not, we might add something or do it later.

Thanks!

@samhouts samhouts merged commit fdad567 into xamarin:4.6.0 Apr 4, 2020
@samhouts samhouts added this to the 4.6.0 milestone Apr 9, 2020
@mrwcjoughin
Copy link

@AndreiMisiukevich by "100 percent cross-platform" does this mean it works on the macOS, UWP, WPF, and GTK targets of Xamarin.Forms as well?

@AndreiMisiukevich
Copy link
Contributor Author

AndreiMisiukevich commented Apr 13, 2020 via email

@Tommigun1980
Copy link

Tommigun1980 commented Apr 16, 2020

Hi.

  1. How does the component calculate the space for the content when expanded? As a test I added the expander around a vertical chat list of mine, and this is the result:
    Temp
    As can be seen, the expander only shows around half of the height of the content. Is this a bug or am I doing something wrong?

  2. I set the header up as such:
    <StackLayout Orientation="Horizontal"> <Label Text="Test2" /> <Label Text="^" HorizontalOptions="EndAndExpand" /> </StackLayout>

Just having a label is of course not enough to denote a foldable area, as the customer would never know it's a tappable widget. So I wanted to test having an upwards arrow indicator that turns into a downwards arrow when expanded. I couldn't find any easy way of doing it. Please advice on how to add a visual element that toggles between two states depending on whether the expander is folded or not. If this is not supported I'd urge to add support for it as I can't see much use for an expander that can't visualise its state.

Thank you.

@AndreiMisiukevich
Copy link
Contributor Author

Hi.

  1. How does the component calculate the space for the content when expanded? As a test I added the expander around a vertical chat list of mine, and this is the result:
    Temp
    As can be seen, the expander only shows around half of the height of the content. Is this a bug or am I doing something wrong?
  2. I set the header up as such:
    <StackLayout Orientation="Horizontal"> <Label Text="Test2" /> <Label Text="^" HorizontalOptions="EndAndExpand" /> </StackLayout>

Just having a label is of course not enough to denote a foldable area, as the customer would never know it's a tappable widget. So I wanted to test having an upwards arrow indicator that turns into a downwards arrow when expanded. I couldn't find any easy way of doing it. Please advice on how to add a visual element that toggles between two states depending on whether the expander is folded or not. If this is not supported I'd urge to add support for it as I can't see much use for an expander that can't visualise its state.

Thank you.

Do you use ListView?
I don't think this control will work with ListView. Now there are several bugs filled for Expander+CollectionView.

Try to user ScrollView+StackLayout. Should work

@AndreiMisiukevich AndreiMisiukevich deleted the expander branch April 16, 2020 22:55
@Tommigun1980
Copy link

Tommigun1980 commented Apr 16, 2020

Hi.

  1. How does the component calculate the space for the content when expanded? As a test I added the expander around a vertical chat list of mine, and this is the result:
    Temp
    As can be seen, the expander only shows around half of the height of the content. Is this a bug or am I doing something wrong?
  2. I set the header up as such:
    <StackLayout Orientation="Horizontal"> <Label Text="Test2" /> <Label Text="^" HorizontalOptions="EndAndExpand" /> </StackLayout>

Just having a label is of course not enough to denote a foldable area, as the customer would never know it's a tappable widget. So I wanted to test having an upwards arrow indicator that turns into a downwards arrow when expanded. I couldn't find any easy way of doing it. Please advice on how to add a visual element that toggles between two states depending on whether the expander is folded or not. If this is not supported I'd urge to add support for it as I can't see much use for an expander that can't visualise its state.
Thank you.

Do you use ListView?
I don't think this control will work with ListView. Now there are several bugs filled for Expander+CollectionView.

Try to user ScrollView+StackLayout. Should work

Thank you for the reply.

I am using a combination of virtualised rendering and collection views. The vertical part is done by a virtualised layout. I can play around with removing it but would rather see all scenarios supported.

Imho one of the largest drawbacks with Xamarin is that you can't just add UI components and have things work, as there's always some incompatibilities between the components. I don't think this should make its way into the main repo unless it works in all scenarios. It is not a good look if you have to rewrite your UIs several times just to find a permutation of components that works.

Also, any pointers regarding toggling a visual element, which I think is mandatory for the consumers to understand that it is a foldable element? I really think it should be doable straight in XAML.

Thanks!

@AndreiMisiukevich
Copy link
Contributor Author

That is why this control is under experimental feature-flag

@benazir46
Copy link

If I generate a list of expanders and add it to a StakeLayout one by one, iOS works most of the time, but Android crashes on first or second time I tap the expander header. Here are the stack traces for both iOS and Android:

System.ArgumentException: NaN is not a valid value for Height

iOS:

  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00056] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:46 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.Expander.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x0000b] in D:\a\1\s\Xamarin.Forms.Core\Expander.cs:76 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717 
  at Xamarin.Forms.ScrollView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x000e1] in D:\a\1\s\Xamarin.Forms.Core\ScrollView.cs:236 
  at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266 
  at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224 
  at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:805 
  at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:392 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/Foundation/NSAction.cs:152 
--- End of stack trace from previous location where exception was thrown ---


  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.1.31/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at Health4LifeApp.iOS.Application.Main (System.String[] args) [0x00001] in /Users/benazir/Documents/XamarinTest-app/XamarinTestApp/XamarinTestApp.iOS/Main.cs:17

Android:

System.ArgumentException: NaN is not a valid value for Height
  at Xamarin.Forms.Size.set_Height (System.Double value) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\Size.cs:51
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00056] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:46
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.Expander.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x0000b] in D:\a\1\s\Xamarin.Forms.Core\Expander.cs:76
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:43
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:80
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:783
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:659
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:717
  at Xamarin.Forms.ScrollView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x000e1] in D:\a\1\s\Xamarin.Forms.Core\ScrollView.cs:236
  at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
  at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
  at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:805
  at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:392
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <cedd971fdca5498396de4148fed1e5b1>:0
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <cedd971fdca5498396de4148fed1e5b1>:0
  at at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)

@AndreiMisiukevich
Copy link
Contributor Author

@benazir46
It would be better to fill a new ticked with the attached sample for reproducing this issue.

@LeoJHarris
Copy link

Hey @AndreiMisiukevich jumping in to say congrats on getting this component into the Xamarin Forms project! 🥇

@AndreiMisiukevich
Copy link
Contributor Author

Hey @AndreiMisiukevich jumping in to say congrats on getting this component into the Xamarin Forms project! 🥇

Thanks, mate)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/expander API-change Heads-up to reviewers that this PR may contain an API change ControlGallery F100 roadmap t/enhancement ➕
Projects
None yet
Development

Successfully merging this pull request may close these issues.