

For more information, see Create Expander content on demand.Īlternatively, an Expander can be created in code: Expander expander = new ExpanderįontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) However, the Expander.ContentTemplate property can be set to content that only gets inflated when the Expander expands for the first time. When setting the Expander.Content property, either implicitly or explicitly, the Expander content is created when the page containing it is navigated to, even if the Expander is collapsed. When the Expander is expanded, tapping its header collapses the Expander. Tapping on the header results in the Expander expanding to reveal its content, which is a Grid containing child controls. In this example, the Expander is collapsed by default and displays a Label as its header.
#TINYURL EXPANDER HOW TO#
The following example shows how to instantiate an Expander in XAML: As part of that move, the ExpanderState enum has been renamed to ExpandState Create an Expander The Expander has been part of Xamarin.Forms and has been moved to the Xamarin.CommunityToolkit. These properties are backed by BindableProperty objects, which means that they can be targets of data bindings, and styled.

This property uses the OneWayToSource binding mode. State, of type ExpandState, which represents the state of the Expander.This property uses the TwoWay binding mode, and has a default value of false. IsExpanded, of type bool, which determines if the Expander is expanded.Header, of type View, which defines the header content.ForceUpdateSizeCommand, of type ICommand, which defines the command that's executed when the size of the Expander is force updated.If this property is not set, then the AnimationLength value will be applied. ExpandAnimationLength, of type uint, which defines the duration of the animation when the Expander expands.ExpandAnimationEasing, of type Easing, which represents the easing function to be applied to the Expander content during expansion.

