Skip to content

Instantly share code, notes, and snippets.

@TimLariviere
Created November 29, 2019 20:12
Show Gist options
  • Save TimLariviere/ae134f3c5471cca09d676c8e359bdab0 to your computer and use it in GitHub Desktop.
Save TimLariviere/ae134f3c5471cca09d676c8e359bdab0 to your computer and use it in GitHub Desktop.
The generated Xamarin.Forms.Core.fs for Fabulous.XamarinForms (Version of 2019-11-29)
This file has been truncated, but you can view the full file.
// Copyright 2018-2019 Fabulous contributors. See LICENSE.md for license.
namespace Fabulous.XamarinForms
#nowarn "59" // cast always holds
#nowarn "66" // cast always holds
#nowarn "67" // cast always holds
open Fabulous
module ViewAttributes =
let CreatedAttribKey : AttributeKey<(obj -> unit)> = AttributeKey<(obj -> unit)>("Created")
let RefAttribKey : AttributeKey<_> = AttributeKey<_>("Ref")
let TagAttribKey : AttributeKey<_> = AttributeKey<_>("Tag")
let CommandAttribKey : AttributeKey<_> = AttributeKey<_>("Command")
let CommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("CommandCanExecute")
let IconOverrideAttribKey : AttributeKey<_> = AttributeKey<_>("IconOverride")
let IsEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsEnabled")
let TextOverrideAttribKey : AttributeKey<_> = AttributeKey<_>("TextOverride")
let NameAttribKey : AttributeKey<_> = AttributeKey<_>("Name")
let AutomationIdAttribKey : AttributeKey<_> = AttributeKey<_>("AutomationId")
let ClassIdAttribKey : AttributeKey<_> = AttributeKey<_>("ClassId")
let EffectsAttribKey : AttributeKey<_> = AttributeKey<_>("Effects")
let MenuAttribKey : AttributeKey<_> = AttributeKey<_>("Menu")
let StyleIdAttribKey : AttributeKey<_> = AttributeKey<_>("StyleId")
let ChildrenAttribKey : AttributeKey<_> = AttributeKey<_>("Children")
let TextAttribKey : AttributeKey<_> = AttributeKey<_>("Text")
let AcceleratorAttribKey : AttributeKey<_> = AttributeKey<_>("Accelerator")
let IconImageSourceAttribKey : AttributeKey<_> = AttributeKey<_>("IconImageSource")
let IsDestructiveAttribKey : AttributeKey<_> = AttributeKey<_>("IsDestructive")
let ToolbarItemOrderAttribKey : AttributeKey<_> = AttributeKey<_>("ToolbarItemOrder")
let PriorityAttribKey : AttributeKey<_> = AttributeKey<_>("Priority")
let TappedAttribKey : AttributeKey<_> = AttributeKey<_>("Tapped")
let ContextActionsAttribKey : AttributeKey<_> = AttributeKey<_>("ContextActions")
let HeightAttribKey : AttributeKey<_> = AttributeKey<_>("Height")
let CompletedAttribKey : AttributeKey<_> = AttributeKey<_>("Completed")
let HorizontalTextAlignmentAttribKey : AttributeKey<_> = AttributeKey<_>("HorizontalTextAlignment")
let KeyboardAttribKey : AttributeKey<_> = AttributeKey<_>("Keyboard")
let LabelAttribKey : AttributeKey<_> = AttributeKey<_>("Label")
let LabelColorAttribKey : AttributeKey<_> = AttributeKey<_>("LabelColor")
let PlaceholderAttribKey : AttributeKey<_> = AttributeKey<_>("Placeholder")
let VerticalTextAlignmentAttribKey : AttributeKey<_> = AttributeKey<_>("VerticalTextAlignment")
let TextChangedAttribKey : AttributeKey<_> = AttributeKey<_>("TextChanged")
let OnChangedAttribKey : AttributeKey<_> = AttributeKey<_>("OnChanged")
let OnAttribKey : AttributeKey<_> = AttributeKey<_>("On")
let OnColorAttribKey : AttributeKey<_> = AttributeKey<_>("OnColor")
let TextCellDetailAttribKey : AttributeKey<_> = AttributeKey<_>("TextCellDetail")
let DetailColorAttribKey : AttributeKey<_> = AttributeKey<_>("DetailColor")
let TextColorAttribKey : AttributeKey<_> = AttributeKey<_>("TextColor")
let ImageSourceAttribKey : AttributeKey<_> = AttributeKey<_>("ImageSource")
let ViewAttribKey : AttributeKey<_> = AttributeKey<_>("View")
let SpansAttribKey : AttributeKey<_> = AttributeKey<_>("Spans")
let GestureRecognizersAttribKey : AttributeKey<_> = AttributeKey<_>("GestureRecognizers")
let CharacterSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("CharacterSpacing")
let BackgroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("BackgroundColor")
let FontAttributesAttribKey : AttributeKey<_> = AttributeKey<_>("FontAttributes")
let FontFamilyAttribKey : AttributeKey<_> = AttributeKey<_>("FontFamily")
let FontSizeAttribKey : AttributeKey<_> = AttributeKey<_>("FontSize")
let ForegroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("ForegroundColor")
let LineHeightAttribKey : AttributeKey<_> = AttributeKey<_>("LineHeight")
let StyleAttribKey : AttributeKey<_> = AttributeKey<_>("Style")
let TextDecorationsAttribKey : AttributeKey<_> = AttributeKey<_>("TextDecorations")
let ButtonsAttribKey : AttributeKey<_> = AttributeKey<_>("Buttons")
let NumberOfClicksRequiredAttribKey : AttributeKey<_> = AttributeKey<_>("NumberOfClicksRequired")
let PanUpdatedAttribKey : AttributeKey<_> = AttributeKey<_>("PanUpdated")
let TouchPointsAttribKey : AttributeKey<_> = AttributeKey<_>("TouchPoints")
let PinchUpdatedAttribKey : AttributeKey<_> = AttributeKey<_>("PinchUpdated")
let SwipeGestureRecognizerDirectionAttribKey : AttributeKey<_> = AttributeKey<_>("SwipeGestureRecognizerDirection")
let ThresholdAttribKey : AttributeKey<_> = AttributeKey<_>("Threshold")
let NumberOfTapsRequiredAttribKey : AttributeKey<_> = AttributeKey<_>("NumberOfTapsRequired")
let ColorAttribKey : AttributeKey<_> = AttributeKey<_>("Color")
let GlyphAttribKey : AttributeKey<_> = AttributeKey<_>("Glyph")
let SizeAttribKey : AttributeKey<_> = AttributeKey<_>("Size")
let StyleClassAttribKey : AttributeKey<_> = AttributeKey<_>("StyleClass")
let ShellBackButtonBehaviorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellBackButtonBehavior")
let ShellBackgroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellBackgroundColor")
let ShellDisabledColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellDisabledColor")
let ShellForegroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellForegroundColor")
let ShellFlyoutBehaviorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellFlyoutBehavior")
let ShellNavBarIsVisibleAttribKey : AttributeKey<_> = AttributeKey<_>("ShellNavBarIsVisible")
let ShellSearchHandlerAttribKey : AttributeKey<_> = AttributeKey<_>("ShellSearchHandler")
let ShellTabBarBackgroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarBackgroundColor")
let ShellTabBarDisabledColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarDisabledColor")
let ShellTabBarForegroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarForegroundColor")
let ShellTabBarIsVisibleAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarIsVisible")
let ShellTabBarTitleColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarTitleColor")
let ShellTabBarUnselectedColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTabBarUnselectedColor")
let ShellTitleColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTitleColor")
let ShellTitleViewAttribKey : AttributeKey<_> = AttributeKey<_>("ShellTitleView")
let ShellUnselectedColorAttribKey : AttributeKey<_> = AttributeKey<_>("ShellUnselectedColor")
let AppearingAttribKey : AttributeKey<_> = AttributeKey<_>("Appearing")
let DisappearingAttribKey : AttributeKey<_> = AttributeKey<_>("Disappearing")
let FlyoutIconAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutIcon")
let IconAttribKey : AttributeKey<_> = AttributeKey<_>("Icon")
let IsTabStopAttribKey : AttributeKey<_> = AttributeKey<_>("IsTabStop")
let RouteAttribKey : AttributeKey<_> = AttributeKey<_>("Route")
let TabIndexAttribKey : AttributeKey<_> = AttributeKey<_>("TabIndex")
let TitleAttribKey : AttributeKey<_> = AttributeKey<_>("Title")
let ContentTemplateAttribKey : AttributeKey<_> = AttributeKey<_>("ContentTemplate")
let MenuItemsAttribKey : AttributeKey<_> = AttributeKey<_>("MenuItems")
let FlyoutDisplayOptionsAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutDisplayOptions")
let ShellItemCurrentItemAttribKey : AttributeKey<_> = AttributeKey<_>("ShellItemCurrentItem")
let ItemsAttribKey : AttributeKey<_> = AttributeKey<_>("Items")
let ShellSectionCurrentItemAttribKey : AttributeKey<_> = AttributeKey<_>("ShellSectionCurrentItem")
let VisualElementFocusedAttribKey : AttributeKey<_> = AttributeKey<_>("VisualElementFocused")
let VisualElementUnfocusedAttribKey : AttributeKey<_> = AttributeKey<_>("VisualElementUnfocused")
let AnchorXAttribKey : AttributeKey<_> = AttributeKey<_>("AnchorX")
let AnchorYAttribKey : AttributeKey<_> = AttributeKey<_>("AnchorY")
let BehaviorsAttribKey : AttributeKey<_> = AttributeKey<_>("Behaviors")
let FlowDirectionAttribKey : AttributeKey<_> = AttributeKey<_>("FlowDirection")
let HeightRequestAttribKey : AttributeKey<_> = AttributeKey<_>("HeightRequest")
let InputTransparentAttribKey : AttributeKey<_> = AttributeKey<_>("InputTransparent")
let IsVisibleAttribKey : AttributeKey<_> = AttributeKey<_>("IsVisible")
let MinimumHeightRequestAttribKey : AttributeKey<_> = AttributeKey<_>("MinimumHeightRequest")
let MinimumWidthRequestAttribKey : AttributeKey<_> = AttributeKey<_>("MinimumWidthRequest")
let OpacityAttribKey : AttributeKey<_> = AttributeKey<_>("Opacity")
let ResourcesAttribKey : AttributeKey<_> = AttributeKey<_>("Resources")
let RotationAttribKey : AttributeKey<_> = AttributeKey<_>("Rotation")
let RotationXAttribKey : AttributeKey<_> = AttributeKey<_>("RotationX")
let RotationYAttribKey : AttributeKey<_> = AttributeKey<_>("RotationY")
let ScaleAttribKey : AttributeKey<_> = AttributeKey<_>("Scale")
let ScaleXAttribKey : AttributeKey<_> = AttributeKey<_>("ScaleX")
let ScaleYAttribKey : AttributeKey<_> = AttributeKey<_>("ScaleY")
let StylesAttribKey : AttributeKey<_> = AttributeKey<_>("Styles")
let StyleSheetsAttribKey : AttributeKey<_> = AttributeKey<_>("StyleSheets")
let TranslationXAttribKey : AttributeKey<_> = AttributeKey<_>("TranslationX")
let TranslationYAttribKey : AttributeKey<_> = AttributeKey<_>("TranslationY")
let VisualAttribKey : AttributeKey<_> = AttributeKey<_>("Visual")
let WidthRequestAttribKey : AttributeKey<_> = AttributeKey<_>("WidthRequest")
let BackgroundImageSourceAttribKey : AttributeKey<_> = AttributeKey<_>("BackgroundImageSource")
let IsBusyAttribKey : AttributeKey<_> = AttributeKey<_>("IsBusy")
let PaddingAttribKey : AttributeKey<_> = AttributeKey<_>("Padding")
let ToolbarItemsAttribKey : AttributeKey<_> = AttributeKey<_>("ToolbarItems")
let UseSafeAreaAttribKey : AttributeKey<_> = AttributeKey<_>("UseSafeArea")
let HasNavigationBarAttribKey : AttributeKey<_> = AttributeKey<_>("HasNavigationBar")
let BackButtonPressedAttribKey : AttributeKey<_> = AttributeKey<_>("BackButtonPressed")
let IsPresentedChangedAttribKey : AttributeKey<_> = AttributeKey<_>("IsPresentedChanged")
let MasterDetailPageDetailAttribKey : AttributeKey<_> = AttributeKey<_>("MasterDetailPageDetail")
let IsGestureEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsGestureEnabled")
let IsPresentedAttribKey : AttributeKey<_> = AttributeKey<_>("IsPresented")
let MasterAttribKey : AttributeKey<_> = AttributeKey<_>("Master")
let MasterBehaviorAttribKey : AttributeKey<_> = AttributeKey<_>("MasterBehavior")
let CurrentPageChangedAttribKey : AttributeKey<_> = AttributeKey<_>("CurrentPageChanged")
let CurrentPageAttribKey : AttributeKey<_> = AttributeKey<_>("CurrentPage")
let BarBackgroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("BarBackgroundColor")
let BarTextColorAttribKey : AttributeKey<_> = AttributeKey<_>("BarTextColor")
let SelectedTabColorAttribKey : AttributeKey<_> = AttributeKey<_>("SelectedTabColor")
let UnselectedTabColorAttribKey : AttributeKey<_> = AttributeKey<_>("UnselectedTabColor")
let PoppedAttribKey : AttributeKey<_> = AttributeKey<_>("Popped")
let PoppedToRootAttribKey : AttributeKey<_> = AttributeKey<_>("PoppedToRoot")
let PushedAttribKey : AttributeKey<_> = AttributeKey<_>("Pushed")
let PagesAttribKey : AttributeKey<_> = AttributeKey<_>("Pages")
let BackButtonTitleAttribKey : AttributeKey<_> = AttributeKey<_>("BackButtonTitle")
let HasBackButtonAttribKey : AttributeKey<_> = AttributeKey<_>("HasBackButton")
let TitleIconImageSourceAttribKey : AttributeKey<_> = AttributeKey<_>("TitleIconImageSource")
let TitleViewAttribKey : AttributeKey<_> = AttributeKey<_>("TitleView")
let ShellNavigatedAttribKey : AttributeKey<_> = AttributeKey<_>("ShellNavigated")
let ShellNavigatingAttribKey : AttributeKey<_> = AttributeKey<_>("ShellNavigating")
let FlyoutBackgroundColorAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutBackgroundColor")
let FlyoutBackgroundImageAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutBackgroundImage")
let FlyoutBackgroundImageAspectAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutBackgroundImageAspect")
let FlyoutBehaviorAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutBehavior")
let FlyoutHeaderAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutHeader")
let FlyoutHeaderBehaviorAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutHeaderBehavior")
let FlyoutIsPresentedAttribKey : AttributeKey<_> = AttributeKey<_>("FlyoutIsPresented")
let GoToAsyncAttribKey : AttributeKey<_> = AttributeKey<_>("GoToAsync")
let ContentAttribKey : AttributeKey<_> = AttributeKey<_>("Content")
let SizeAllocatedAttribKey : AttributeKey<_> = AttributeKey<_>("SizeAllocated")
let HorizontalOptionsAttribKey : AttributeKey<_> = AttributeKey<_>("HorizontalOptions")
let MarginAttribKey : AttributeKey<_> = AttributeKey<_>("Margin")
let VerticalOptionsAttribKey : AttributeKey<_> = AttributeKey<_>("VerticalOptions")
let IsRunningAttribKey : AttributeKey<_> = AttributeKey<_>("IsRunning")
let BoxViewCornerRadiusAttribKey : AttributeKey<_> = AttributeKey<_>("BoxViewCornerRadius")
let BorderColorAttribKey : AttributeKey<_> = AttributeKey<_>("BorderColor")
let BorderWidthAttribKey : AttributeKey<_> = AttributeKey<_>("BorderWidth")
let ContentLayoutAttribKey : AttributeKey<_> = AttributeKey<_>("ContentLayout")
let ButtonCornerRadiusAttribKey : AttributeKey<_> = AttributeKey<_>("ButtonCornerRadius")
let CheckedChangedAttribKey : AttributeKey<_> = AttributeKey<_>("CheckedChanged")
let IsCheckedAttribKey : AttributeKey<_> = AttributeKey<_>("IsChecked")
let DateSelectedAttribKey : AttributeKey<_> = AttributeKey<_>("DateSelected")
let DateAttribKey : AttributeKey<_> = AttributeKey<_>("Date")
let FormatAttribKey : AttributeKey<_> = AttributeKey<_>("Format")
let MaximumDateAttribKey : AttributeKey<_> = AttributeKey<_>("MaximumDate")
let MinimumDateAttribKey : AttributeKey<_> = AttributeKey<_>("MinimumDate")
let AspectAttribKey : AttributeKey<_> = AttributeKey<_>("Aspect")
let IsOpaqueAttribKey : AttributeKey<_> = AttributeKey<_>("IsOpaque")
let ClickedAttribKey : AttributeKey<_> = AttributeKey<_>("Clicked")
let PressedAttribKey : AttributeKey<_> = AttributeKey<_>("Pressed")
let ReleasedAttribKey : AttributeKey<_> = AttributeKey<_>("Released")
let ImageButtonCornerRadiusAttribKey : AttributeKey<_> = AttributeKey<_>("ImageButtonCornerRadius")
let ImageButtonSourceAttribKey : AttributeKey<_> = AttributeKey<_>("ImageButtonSource")
let IsReadOnlyAttribKey : AttributeKey<_> = AttributeKey<_>("IsReadOnly")
let IsSpellCheckEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsSpellCheckEnabled")
let MaxLengthAttribKey : AttributeKey<_> = AttributeKey<_>("MaxLength")
let AutoSizeAttribKey : AttributeKey<_> = AttributeKey<_>("AutoSize")
let IsTextPredictionEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsTextPredictionEnabled")
let PlaceholderColorAttribKey : AttributeKey<_> = AttributeKey<_>("PlaceholderColor")
let ClearButtonVisibilityAttribKey : AttributeKey<_> = AttributeKey<_>("ClearButtonVisibility")
let CursorPositionAttribKey : AttributeKey<_> = AttributeKey<_>("CursorPosition")
let IsPasswordAttribKey : AttributeKey<_> = AttributeKey<_>("IsPassword")
let ReturnCommandAttribKey : AttributeKey<_> = AttributeKey<_>("ReturnCommand")
let ReturnCommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("ReturnCommandCanExecute")
let ReturnTypeAttribKey : AttributeKey<_> = AttributeKey<_>("ReturnType")
let SelectionLengthAttribKey : AttributeKey<_> = AttributeKey<_>("SelectionLength")
let CancelButtonColorAttribKey : AttributeKey<_> = AttributeKey<_>("CancelButtonColor")
let SearchCommandAttribKey : AttributeKey<_> = AttributeKey<_>("SearchCommand")
let SearchCommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("SearchCommandCanExecute")
let ItemsViewScrolledAttribKey : AttributeKey<_> = AttributeKey<_>("ItemsViewScrolled")
let EmptyViewAttribKey : AttributeKey<_> = AttributeKey<_>("EmptyView")
let HorizontalScrollBarVisibilityAttribKey : AttributeKey<_> = AttributeKey<_>("HorizontalScrollBarVisibility")
let ItemSizingStrategyAttribKey : AttributeKey<_> = AttributeKey<_>("ItemSizingStrategy")
let ItemsUpdatingScrollModeAttribKey : AttributeKey<_> = AttributeKey<_>("ItemsUpdatingScrollMode")
let ItemsViewItemsSourceAttribKey : AttributeKey<_> = AttributeKey<_>("ItemsViewItemsSource")
let RemainingItemsThresholdAttribKey : AttributeKey<_> = AttributeKey<_>("RemainingItemsThreshold")
let RemainingItemsThresholdReachedCommandAttribKey : AttributeKey<_> = AttributeKey<_>("RemainingItemsThresholdReachedCommand")
let RemainingItemsThresholdReachedCommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("RemainingItemsThresholdReachedCommandCanExecute")
let ItemsViewScrollToAttribKey : AttributeKey<_> = AttributeKey<_>("ItemsViewScrollTo")
let VerticalScrollBarVisibilityAttribKey : AttributeKey<_> = AttributeKey<_>("VerticalScrollBarVisibility")
let StructuredItemsViewFooterAttribKey : AttributeKey<_> = AttributeKey<_>("StructuredItemsViewFooter")
let StructuredItemsViewHeaderAttribKey : AttributeKey<_> = AttributeKey<_>("StructuredItemsViewHeader")
let StructuredItemsViewItemsLayoutAttribKey : AttributeKey<_> = AttributeKey<_>("StructuredItemsViewItemsLayout")
let CurrentItemChangedAttribKey : AttributeKey<_> = AttributeKey<_>("CurrentItemChanged")
let PositionChangedAttribKey : AttributeKey<_> = AttributeKey<_>("PositionChanged")
let XFCarouselViewCurrentItemAttribKey : AttributeKey<_> = AttributeKey<_>("XFCarouselViewCurrentItem")
let IsBounceEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsBounceEnabled")
let IsScrollAnimatedAttribKey : AttributeKey<_> = AttributeKey<_>("IsScrollAnimated")
let IsSwipeEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsSwipeEnabled")
let XFCarouselViewItemsLayoutAttribKey : AttributeKey<_> = AttributeKey<_>("XFCarouselViewItemsLayout")
let NumberOfSideItemsAttribKey : AttributeKey<_> = AttributeKey<_>("NumberOfSideItems")
let PeekAreaInsetsAttribKey : AttributeKey<_> = AttributeKey<_>("PeekAreaInsets")
let XFCarouselViewPositionAttribKey : AttributeKey<_> = AttributeKey<_>("XFCarouselViewPosition")
let SelectionChangedAttribKey : AttributeKey<_> = AttributeKey<_>("SelectionChanged")
let SelectedItemAttribKey : AttributeKey<_> = AttributeKey<_>("SelectedItem")
let SelectedItemsAttribKey : AttributeKey<_> = AttributeKey<_>("SelectedItems")
let SelectableItemsViewSelectionModeAttribKey : AttributeKey<_> = AttributeKey<_>("SelectableItemsViewSelectionMode")
let GroupFooterTemplateAttribKey : AttributeKey<_> = AttributeKey<_>("GroupFooterTemplate")
let GroupHeaderTemplateAttribKey : AttributeKey<_> = AttributeKey<_>("GroupHeaderTemplate")
let IsGroupedAttribKey : AttributeKey<_> = AttributeKey<_>("IsGrouped")
let ItemAppearingAttribKey : AttributeKey<_> = AttributeKey<_>("ItemAppearing")
let ItemDisappearingAttribKey : AttributeKey<_> = AttributeKey<_>("ItemDisappearing")
let XFListViewItemSelectedAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewItemSelected")
let ItemTappedAttribKey : AttributeKey<_> = AttributeKey<_>("ItemTapped")
let RefreshingAttribKey : AttributeKey<_> = AttributeKey<_>("Refreshing")
let XFListViewScrolledAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewScrolled")
let XFListViewFooterAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewFooter")
let HasUnevenRowsAttribKey : AttributeKey<_> = AttributeKey<_>("HasUnevenRows")
let XFListViewHeaderAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewHeader")
let IsGroupingEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsGroupingEnabled")
let IsPullToRefreshEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsPullToRefreshEnabled")
let IsRefreshingAttribKey : AttributeKey<_> = AttributeKey<_>("IsRefreshing")
let RefreshCommandAttribKey : AttributeKey<_> = AttributeKey<_>("RefreshCommand")
let RefreshCommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("RefreshCommandCanExecute")
let RefreshControlColorAttribKey : AttributeKey<_> = AttributeKey<_>("RefreshControlColor")
let RowHeightAttribKey : AttributeKey<_> = AttributeKey<_>("RowHeight")
let XFListViewScrollToAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewScrollTo")
let XFListViewSelectionModeAttribKey : AttributeKey<_> = AttributeKey<_>("XFListViewSelectionMode")
let SeparatorColorAttribKey : AttributeKey<_> = AttributeKey<_>("SeparatorColor")
let SeparatorVisibilityAttribKey : AttributeKey<_> = AttributeKey<_>("SeparatorVisibility")
let ListViewGroupedItemSelectedAttribKey : AttributeKey<_> = AttributeKey<_>("ListViewGroupedItemSelected")
let ListViewGroupedItemsSourceAttribKey : AttributeKey<_> = AttributeKey<_>("ListViewGroupedItemsSource")
let ListViewGroupedScrollToAttribKey : AttributeKey<_> = AttributeKey<_>("ListViewGroupedScrollTo")
let ShowJumpListAttribKey : AttributeKey<_> = AttributeKey<_>("ShowJumpList")
let FormattedTextAttribKey : AttributeKey<_> = AttributeKey<_>("FormattedText")
let LineBreakModeAttribKey : AttributeKey<_> = AttributeKey<_>("LineBreakMode")
let MaxLinesAttribKey : AttributeKey<_> = AttributeKey<_>("MaxLines")
let TextTypeAttribKey : AttributeKey<_> = AttributeKey<_>("TextType")
let CascadeInputTransparentAttribKey : AttributeKey<_> = AttributeKey<_>("CascadeInputTransparent")
let IsClippedToBoundsAttribKey : AttributeKey<_> = AttributeKey<_>("IsClippedToBounds")
let LayoutBoundsAttribKey : AttributeKey<_> = AttributeKey<_>("LayoutBounds")
let LayoutFlagsAttribKey : AttributeKey<_> = AttributeKey<_>("LayoutFlags")
let AlignContentAttribKey : AttributeKey<_> = AttributeKey<_>("AlignContent")
let AlignItemsAttribKey : AttributeKey<_> = AttributeKey<_>("AlignItems")
let AlignSelfAttribKey : AttributeKey<_> = AttributeKey<_>("AlignSelf")
let OrderAttribKey : AttributeKey<_> = AttributeKey<_>("Order")
let BasisAttribKey : AttributeKey<_> = AttributeKey<_>("Basis")
let GrowAttribKey : AttributeKey<_> = AttributeKey<_>("Grow")
let ShrinkAttribKey : AttributeKey<_> = AttributeKey<_>("Shrink")
let FlexLayoutDirectionAttribKey : AttributeKey<_> = AttributeKey<_>("FlexLayoutDirection")
let JustifyContentAttribKey : AttributeKey<_> = AttributeKey<_>("JustifyContent")
let FlexLayoutPositionAttribKey : AttributeKey<_> = AttributeKey<_>("FlexLayoutPosition")
let WrapAttribKey : AttributeKey<_> = AttributeKey<_>("Wrap")
let ColumnDefinitionsAttribKey : AttributeKey<_> = AttributeKey<_>("ColumnDefinitions")
let ColumnSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("ColumnSpacing")
let RowDefinitionsAttribKey : AttributeKey<_> = AttributeKey<_>("RowDefinitions")
let RowSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("RowSpacing")
let RowAttribKey : AttributeKey<_> = AttributeKey<_>("Row")
let RowSpanAttribKey : AttributeKey<_> = AttributeKey<_>("RowSpan")
let ColumnAttribKey : AttributeKey<_> = AttributeKey<_>("Column")
let ColumnSpanAttribKey : AttributeKey<_> = AttributeKey<_>("ColumnSpan")
let BoundsConstraintAttribKey : AttributeKey<_> = AttributeKey<_>("BoundsConstraint")
let HeightConstraintAttribKey : AttributeKey<_> = AttributeKey<_>("HeightConstraint")
let WidthConstraintAttribKey : AttributeKey<_> = AttributeKey<_>("WidthConstraint")
let XConstraintAttribKey : AttributeKey<_> = AttributeKey<_>("XConstraint")
let YConstraintAttribKey : AttributeKey<_> = AttributeKey<_>("YConstraint")
let StackLayoutOrientationAttribKey : AttributeKey<_> = AttributeKey<_>("StackLayoutOrientation")
let SpacingAttribKey : AttributeKey<_> = AttributeKey<_>("Spacing")
let ScrollViewScrolledAttribKey : AttributeKey<_> = AttributeKey<_>("ScrollViewScrolled")
let ScrollViewOrientationAttribKey : AttributeKey<_> = AttributeKey<_>("ScrollViewOrientation")
let ScrollViewScrollToAttribKey : AttributeKey<_> = AttributeKey<_>("ScrollViewScrollTo")
let FrameCornerRadiusAttribKey : AttributeKey<_> = AttributeKey<_>("FrameCornerRadius")
let HasShadowAttribKey : AttributeKey<_> = AttributeKey<_>("HasShadow")
let RefreshColorAttribKey : AttributeKey<_> = AttributeKey<_>("RefreshColor")
let HasRenderLoopAttribKey : AttributeKey<_> = AttributeKey<_>("HasRenderLoop")
let SelectedIndexChangedAttribKey : AttributeKey<_> = AttributeKey<_>("SelectedIndexChanged")
let PickerItemsSourceAttribKey : AttributeKey<_> = AttributeKey<_>("PickerItemsSource")
let SelectedIndexAttribKey : AttributeKey<_> = AttributeKey<_>("SelectedIndex")
let TitleColorAttribKey : AttributeKey<_> = AttributeKey<_>("TitleColor")
let ProgressAttribKey : AttributeKey<_> = AttributeKey<_>("Progress")
let ProgressColorAttribKey : AttributeKey<_> = AttributeKey<_>("ProgressColor")
let DragCompletedAttribKey : AttributeKey<_> = AttributeKey<_>("DragCompleted")
let DragStartedAttribKey : AttributeKey<_> = AttributeKey<_>("DragStarted")
let ValueChangedAttribKey : AttributeKey<_> = AttributeKey<_>("ValueChanged")
let MaximumTrackColorAttribKey : AttributeKey<_> = AttributeKey<_>("MaximumTrackColor")
let MinimumMaximumAttribKey : AttributeKey<_> = AttributeKey<_>("MinimumMaximum")
let MinimumTrackColorAttribKey : AttributeKey<_> = AttributeKey<_>("MinimumTrackColor")
let ThumbColorAttribKey : AttributeKey<_> = AttributeKey<_>("ThumbColor")
let ThumbImageSourceAttribKey : AttributeKey<_> = AttributeKey<_>("ThumbImageSource")
let ValueAttribKey : AttributeKey<_> = AttributeKey<_>("Value")
let IncrementAttribKey : AttributeKey<_> = AttributeKey<_>("Increment")
let ToggledAttribKey : AttributeKey<_> = AttributeKey<_>("Toggled")
let IsToggledAttribKey : AttributeKey<_> = AttributeKey<_>("IsToggled")
let IntentAttribKey : AttributeKey<_> = AttributeKey<_>("Intent")
let RootAttribKey : AttributeKey<_> = AttributeKey<_>("Root")
let TimeAttribKey : AttributeKey<_> = AttributeKey<_>("Time")
let TimeChangedAttribKey : AttributeKey<_> = AttributeKey<_>("TimeChanged")
let EvalRequestedAttribKey : AttributeKey<_> = AttributeKey<_>("EvalRequested")
let GoBackRequestedAttribKey : AttributeKey<_> = AttributeKey<_>("GoBackRequested")
let GoForwardRequestedAttribKey : AttributeKey<_> = AttributeKey<_>("GoForwardRequested")
let WebViewNavigatedAttribKey : AttributeKey<_> = AttributeKey<_>("WebViewNavigated")
let WebViewNavigatingAttribKey : AttributeKey<_> = AttributeKey<_>("WebViewNavigating")
let ReloadRequestedAttribKey : AttributeKey<_> = AttributeKey<_>("ReloadRequested")
let WebViewSourceAttribKey : AttributeKey<_> = AttributeKey<_>("WebViewSource")
let ReloadAttribKey : AttributeKey<_> = AttributeKey<_>("Reload")
let SnapPointsAlignmentAttribKey : AttributeKey<_> = AttributeKey<_>("SnapPointsAlignment")
let SnapPointsTypeAttribKey : AttributeKey<_> = AttributeKey<_>("SnapPointsType")
let HorizontalItemSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("HorizontalItemSpacing")
let SpanAttribKey : AttributeKey<_> = AttributeKey<_>("Span")
let VerticalItemSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("VerticalItemSpacing")
let ItemSpacingAttribKey : AttributeKey<_> = AttributeKey<_>("ItemSpacing")
let XFSearchHandlerUnfocusedAttribKey : AttributeKey<_> = AttributeKey<_>("XFSearchHandlerUnfocused")
let XFSearchHandlerFocusedAttribKey : AttributeKey<_> = AttributeKey<_>("XFSearchHandlerFocused")
let ClearIconAttribKey : AttributeKey<_> = AttributeKey<_>("ClearIcon")
let ClearIconHelpTextAttribKey : AttributeKey<_> = AttributeKey<_>("ClearIconHelpText")
let ClearIconNameAttribKey : AttributeKey<_> = AttributeKey<_>("ClearIconName")
let ClearPlaceholderCommandAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderCommand")
let ClearPlaceholderCommandCanExecuteAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderCommandCanExecute")
let ClearPlaceholderEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderEnabled")
let ClearPlaceholderHelpTextAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderHelpText")
let ClearPlaceholderIconAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderIcon")
let ClearPlaceholderNameAttribKey : AttributeKey<_> = AttributeKey<_>("ClearPlaceholderName")
let IsSearchEnabledAttribKey : AttributeKey<_> = AttributeKey<_>("IsSearchEnabled")
let XFSearchHandlerItemsSourceAttribKey : AttributeKey<_> = AttributeKey<_>("XFSearchHandlerItemsSource")
let QueryAttribKey : AttributeKey<_> = AttributeKey<_>("Query")
let QueryIconAttribKey : AttributeKey<_> = AttributeKey<_>("QueryIcon")
let QueryIconHelpTextAttribKey : AttributeKey<_> = AttributeKey<_>("QueryIconHelpText")
let QueryIconNameAttribKey : AttributeKey<_> = AttributeKey<_>("QueryIconName")
let SearchBoxVisibilityAttribKey : AttributeKey<_> = AttributeKey<_>("SearchBoxVisibility")
let ShowsResultsAttribKey : AttributeKey<_> = AttributeKey<_>("ShowsResults")
let SearchHandlerItemSelectedAttribKey : AttributeKey<_> = AttributeKey<_>("SearchHandlerItemSelected")
let QueryChangedAttribKey : AttributeKey<_> = AttributeKey<_>("QueryChanged")
let QueryConfirmedAttribKey : AttributeKey<_> = AttributeKey<_>("QueryConfirmed")
type ViewBuilders() =
/// Builds the attributes for a BindableObject in the view
static member inline BuildBindableObject(attribCount: int,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match ref with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match tag with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match created with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = new AttributesBuilder(attribCount)
match ref with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RefAttribKey, (v))
match tag with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TagAttribKey, (v))
match created with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CreatedAttribKey, (v))
attribBuilder
static member UpdateBindableObject (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.BindableObject) =
()
/// Builds the attributes for a BackButtonBehavior in the view
static member inline BuildBackButtonBehavior(attribCount: int,
?command: unit -> unit,
?commandCanExecute: bool,
?iconOverride: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?textOverride: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match iconOverride with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textOverride with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBindableObject(attribCount, ?ref=ref, ?tag=tag, ?created=created)
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match iconOverride with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IconOverrideAttribKey, (v))
match isEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsEnabledAttribKey, (v))
match textOverride with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextOverrideAttribKey, (v))
attribBuilder
static member CreateBackButtonBehavior () : Xamarin.Forms.BackButtonBehavior =
new Xamarin.Forms.BackButtonBehavior()
static member UpdateBackButtonBehavior (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.BackButtonBehavior) =
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevIconOverrideOpt = ValueNone
let mutable currIconOverrideOpt = ValueNone
let mutable prevIsEnabledOpt = ValueNone
let mutable currIsEnabledOpt = ValueNone
let mutable prevTextOverrideOpt = ValueNone
let mutable currTextOverrideOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IconOverrideAttribKey.KeyValue then
currIconOverrideOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
currIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextOverrideAttribKey.KeyValue then
currTextOverrideOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IconOverrideAttribKey.KeyValue then
prevIconOverrideOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
prevIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextOverrideAttribKey.KeyValue then
prevTextOverrideOpt <- ValueSome (kvp.Value :?> string)
// Update inherited members
ViewBuilders.UpdateBindableObject (prevOpt, curr, target)
// Update properties
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.BackButtonBehavior) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevIconOverrideOpt, currIconOverrideOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IconOverride <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BackButtonBehavior.IconOverrideProperty
| ValueNone, ValueNone -> ()
match prevIsEnabledOpt, currIsEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BackButtonBehavior.IsEnabledProperty
| ValueNone, ValueNone -> ()
match prevTextOverrideOpt, currTextOverrideOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextOverride <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BackButtonBehavior.TextOverrideProperty
| ValueNone, ValueNone -> ()
static member inline ConstructBackButtonBehavior(?command: unit -> unit,
?commandCanExecute: bool,
?iconOverride: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?textOverride: string,
?ref: ViewRef<Xamarin.Forms.BackButtonBehavior>,
?tag: obj,
?created: (Xamarin.Forms.BackButtonBehavior -> unit)) =
let attribBuilder = ViewBuilders.BuildBackButtonBehavior(0,
?command=command,
?commandCanExecute=commandCanExecute,
?iconOverride=iconOverride,
?isEnabled=isEnabled,
?textOverride=textOverride,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.BackButtonBehavior>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.BackButtonBehavior> target))))
ViewElement.Create<Xamarin.Forms.BackButtonBehavior>(ViewBuilders.CreateBackButtonBehavior, (fun prevOpt curr target -> ViewBuilders.UpdateBackButtonBehavior(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Effect in the view
static member inline BuildEffect(attribCount: int,
?name: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match name with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBindableObject(attribCount, ?ref=ref, ?tag=tag, ?created=created)
match name with None -> () | Some v -> attribBuilder.Add(ViewAttributes.NameAttribKey, (v))
attribBuilder
static member CreateEffect () : Fabulous.XamarinForms.CustomEffect =
new Fabulous.XamarinForms.CustomEffect()
static member UpdateEffect (prevOpt: ViewElement voption, curr: ViewElement, target: Fabulous.XamarinForms.CustomEffect) =
let mutable prevNameOpt = ValueNone
let mutable currNameOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.NameAttribKey.KeyValue then
currNameOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.NameAttribKey.KeyValue then
prevNameOpt <- ValueSome (kvp.Value :?> string)
// Update inherited members
ViewBuilders.UpdateBindableObject (prevOpt, curr, target)
// Update properties
match prevNameOpt, currNameOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Name <- currValue
| ValueSome _, ValueNone -> target.Name <- null
| ValueNone, ValueNone -> ()
static member inline ConstructEffect(?name: string,
?ref: ViewRef<Fabulous.XamarinForms.CustomEffect>,
?tag: obj,
?created: (Fabulous.XamarinForms.CustomEffect -> unit)) =
let attribBuilder = ViewBuilders.BuildEffect(0,
?name=name,
?ref=(match ref with None -> None | Some (ref: ViewRef<Fabulous.XamarinForms.CustomEffect>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Fabulous.XamarinForms.CustomEffect> target))))
ViewElement.Create<Fabulous.XamarinForms.CustomEffect>(ViewBuilders.CreateEffect, (fun prevOpt curr target -> ViewBuilders.UpdateEffect(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Element in the view
static member inline BuildElement(attribCount: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match automationId with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match classId with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match effects with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match menu with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match styleId with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBindableObject(attribCount, ?ref=ref, ?tag=tag, ?created=created)
match automationId with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AutomationIdAttribKey, (v))
match classId with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ClassIdAttribKey, (v))
match effects with None -> () | Some v -> attribBuilder.Add(ViewAttributes.EffectsAttribKey, Array.ofList(v))
match menu with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MenuAttribKey, (v))
match styleId with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StyleIdAttribKey, (v))
attribBuilder
static member UpdateElement (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Element) =
let mutable prevAutomationIdOpt = ValueNone
let mutable currAutomationIdOpt = ValueNone
let mutable prevClassIdOpt = ValueNone
let mutable currClassIdOpt = ValueNone
let mutable prevEffectsOpt = ValueNone
let mutable currEffectsOpt = ValueNone
let mutable prevMenuOpt = ValueNone
let mutable currMenuOpt = ValueNone
let mutable prevStyleIdOpt = ValueNone
let mutable currStyleIdOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.AutomationIdAttribKey.KeyValue then
currAutomationIdOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.ClassIdAttribKey.KeyValue then
currClassIdOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.EffectsAttribKey.KeyValue then
currEffectsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.MenuAttribKey.KeyValue then
currMenuOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.StyleIdAttribKey.KeyValue then
currStyleIdOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.AutomationIdAttribKey.KeyValue then
prevAutomationIdOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.ClassIdAttribKey.KeyValue then
prevClassIdOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.EffectsAttribKey.KeyValue then
prevEffectsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.MenuAttribKey.KeyValue then
prevMenuOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.StyleIdAttribKey.KeyValue then
prevStyleIdOpt <- ValueSome (kvp.Value :?> string)
// Update inherited members
ViewBuilders.UpdateBindableObject (prevOpt, curr, target)
// Update properties
match prevAutomationIdOpt, currAutomationIdOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.AutomationId <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Element.AutomationIdProperty
| ValueNone, ValueNone -> ()
match prevClassIdOpt, currClassIdOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ClassId <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Element.ClassIdProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateElementEffects prevEffectsOpt currEffectsOpt target
(fun _ _ _ -> ())
ViewUpdaters.updateElementMenu prevMenuOpt currMenuOpt target
match prevStyleIdOpt, currStyleIdOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.StyleId <- currValue
| ValueSome _, ValueNone -> target.StyleId <- null
| ValueNone, ValueNone -> ()
/// Builds the attributes for a BaseMenuItem in the view
static member inline BuildBaseMenuItem(attribCount: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
attribBuilder
static member UpdateBaseMenuItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.BaseMenuItem) =
ViewBuilders.UpdateElement (prevOpt, curr, target)
/// Builds the attributes for a Menu in the view
static member inline BuildMenu(attribCount: int,
?children: ViewElement list,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match children with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBaseMenuItem(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match children with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ChildrenAttribKey, Array.ofList(v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
attribBuilder
static member CreateMenu () : Xamarin.Forms.Menu =
new Xamarin.Forms.Menu()
static member UpdateMenu (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Menu) =
let mutable prevChildrenOpt = ValueNone
let mutable currChildrenOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ChildrenAttribKey.KeyValue then
currChildrenOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ChildrenAttribKey.KeyValue then
prevChildrenOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
// Update inherited members
ViewBuilders.UpdateBaseMenuItem (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateMenuChildren prevChildrenOpt currChildrenOpt target
(fun _ _ _ -> ())
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.Text <- null
| ValueNone, ValueNone -> ()
static member inline ConstructMenu(?children: ViewElement list,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Menu>,
?tag: obj,
?created: (Xamarin.Forms.Menu -> unit)) =
let attribBuilder = ViewBuilders.BuildMenu(0,
?children=children,
?text=text,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Menu>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Menu> target))))
ViewElement.Create<Xamarin.Forms.Menu>(ViewBuilders.CreateMenu, (fun prevOpt curr target -> ViewBuilders.UpdateMenu(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a MenuItem in the view
static member inline BuildMenuItem(attribCount: int,
?accelerator: string,
?command: unit -> unit,
?commandCanExecute: bool,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isDestructive: bool,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match accelerator with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match icon with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isDestructive with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBaseMenuItem(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match accelerator with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AcceleratorAttribKey, (v))
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match icon with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IconImageSourceAttribKey, (v))
match isDestructive with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsDestructiveAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
attribBuilder
static member CreateMenuItem () : Xamarin.Forms.MenuItem =
new Xamarin.Forms.MenuItem()
static member UpdateMenuItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.MenuItem) =
let mutable prevAcceleratorOpt = ValueNone
let mutable currAcceleratorOpt = ValueNone
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevIconImageSourceOpt = ValueNone
let mutable currIconImageSourceOpt = ValueNone
let mutable prevIsDestructiveOpt = ValueNone
let mutable currIsDestructiveOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.AcceleratorAttribKey.KeyValue then
currAcceleratorOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IconImageSourceAttribKey.KeyValue then
currIconImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsDestructiveAttribKey.KeyValue then
currIsDestructiveOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.AcceleratorAttribKey.KeyValue then
prevAcceleratorOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IconImageSourceAttribKey.KeyValue then
prevIconImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsDestructiveAttribKey.KeyValue then
prevIsDestructiveOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
// Update inherited members
ViewBuilders.UpdateBaseMenuItem (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateMenuItemAccelerator prevAcceleratorOpt currAcceleratorOpt target
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.MenuItem) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevIconImageSourceOpt, currIconImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IconImageSource <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MenuItem.IconImageSourceProperty
| ValueNone, ValueNone -> ()
match prevIsDestructiveOpt, currIsDestructiveOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsDestructive <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MenuItem.IsDestructiveProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MenuItem.TextProperty
| ValueNone, ValueNone -> ()
static member inline ConstructMenuItem(?accelerator: string,
?command: unit -> unit,
?commandCanExecute: bool,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isDestructive: bool,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.MenuItem>,
?tag: obj,
?created: (Xamarin.Forms.MenuItem -> unit)) =
let attribBuilder = ViewBuilders.BuildMenuItem(0,
?accelerator=accelerator,
?command=command,
?commandCanExecute=commandCanExecute,
?icon=icon,
?isDestructive=isDestructive,
?text=text,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.MenuItem>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.MenuItem> target))))
ViewElement.Create<Xamarin.Forms.MenuItem>(ViewBuilders.CreateMenuItem, (fun prevOpt curr target -> ViewBuilders.UpdateMenuItem(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ToolbarItem in the view
static member inline BuildToolbarItem(attribCount: int,
?order: Xamarin.Forms.ToolbarItemOrder,
?priority: int,
?accelerator: string,
?command: unit -> unit,
?commandCanExecute: bool,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isDestructive: bool,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match order with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match priority with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildMenuItem(attribCount, ?accelerator=accelerator, ?command=command, ?commandCanExecute=commandCanExecute, ?icon=icon, ?isDestructive=isDestructive,
?text=text, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu,
?styleId=styleId, ?ref=ref, ?tag=tag, ?created=created)
match order with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ToolbarItemOrderAttribKey, (v))
match priority with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PriorityAttribKey, (v))
attribBuilder
static member CreateToolbarItem () : Xamarin.Forms.ToolbarItem =
new Xamarin.Forms.ToolbarItem()
static member UpdateToolbarItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ToolbarItem) =
let mutable prevToolbarItemOrderOpt = ValueNone
let mutable currToolbarItemOrderOpt = ValueNone
let mutable prevPriorityOpt = ValueNone
let mutable currPriorityOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ToolbarItemOrderAttribKey.KeyValue then
currToolbarItemOrderOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ToolbarItemOrder)
if kvp.Key = ViewAttributes.PriorityAttribKey.KeyValue then
currPriorityOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ToolbarItemOrderAttribKey.KeyValue then
prevToolbarItemOrderOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ToolbarItemOrder)
if kvp.Key = ViewAttributes.PriorityAttribKey.KeyValue then
prevPriorityOpt <- ValueSome (kvp.Value :?> int)
// Update inherited members
ViewBuilders.UpdateMenuItem (prevOpt, curr, target)
// Update properties
match prevToolbarItemOrderOpt, currToolbarItemOrderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Order <- currValue
| ValueSome _, ValueNone -> target.Order <- Xamarin.Forms.ToolbarItemOrder.Default
| ValueNone, ValueNone -> ()
match prevPriorityOpt, currPriorityOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Priority <- currValue
| ValueSome _, ValueNone -> target.Priority <- -1
| ValueNone, ValueNone -> ()
static member inline ConstructToolbarItem(?order: Xamarin.Forms.ToolbarItemOrder,
?priority: int,
?accelerator: string,
?command: unit -> unit,
?commandCanExecute: bool,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isDestructive: bool,
?text: string,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ToolbarItem>,
?tag: obj,
?created: (Xamarin.Forms.ToolbarItem -> unit)) =
let attribBuilder = ViewBuilders.BuildToolbarItem(0,
?order=order,
?priority=priority,
?accelerator=accelerator,
?command=command,
?commandCanExecute=commandCanExecute,
?icon=icon,
?isDestructive=isDestructive,
?text=text,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ToolbarItem>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ToolbarItem> target))))
ViewElement.Create<Xamarin.Forms.ToolbarItem>(ViewBuilders.CreateToolbarItem, (fun prevOpt curr target -> ViewBuilders.UpdateToolbarItem(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Cell in the view
static member inline BuildCell(attribCount: int,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match contextActions with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match height with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match tapped with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match contextActions with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ContextActionsAttribKey, Array.ofList(v))
match height with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HeightAttribKey, (v))
match isEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsEnabledAttribKey, (v))
match tapped with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TappedAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
attribBuilder
static member UpdateCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Cell) =
let mutable prevTappedOpt = ValueNone
let mutable currTappedOpt = ValueNone
let mutable prevContextActionsOpt = ValueNone
let mutable currContextActionsOpt = ValueNone
let mutable prevHeightOpt = ValueNone
let mutable currHeightOpt = ValueNone
let mutable prevIsEnabledOpt = ValueNone
let mutable currIsEnabledOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.TappedAttribKey.KeyValue then
currTappedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.ContextActionsAttribKey.KeyValue then
currContextActionsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.HeightAttribKey.KeyValue then
currHeightOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
currIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.TappedAttribKey.KeyValue then
prevTappedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.ContextActionsAttribKey.KeyValue then
prevContextActionsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.HeightAttribKey.KeyValue then
prevHeightOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
prevIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
// Unsubscribe previous event handlers
let shouldUpdateTapped = not ((identical prevTappedOpt currTappedOpt))
if shouldUpdateTapped then
match prevTappedOpt with
| ValueSome prevValue -> target.Tapped.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateCollectionGeneric prevContextActionsOpt currContextActionsOpt target.ContextActions
(fun (x:ViewElement) -> x.Create() :?> Xamarin.Forms.MenuItem)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
match prevHeightOpt, currHeightOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Height <- currValue
| ValueSome _, ValueNone -> target.Height <- -1.
| ValueNone, ValueNone -> ()
match prevIsEnabledOpt, currIsEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Cell.IsEnabledProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateTapped then
match currTappedOpt with
| ValueSome currValue -> target.Tapped.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a XFEntryCell in the view
static member inline BuildXFEntryCell(attribCount: int,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?keyboard: Xamarin.Forms.Keyboard,
?label: string,
?labelColor: Xamarin.Forms.Color,
?placeholder: string,
?text: string,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?completed: string -> unit,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match horizontalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match keyboard with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match label with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match labelColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholder with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match verticalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match completed with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildCell(attribCount, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?tapped=tapped, ?created=created)
match horizontalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HorizontalTextAlignmentAttribKey, (v))
match keyboard with None -> () | Some v -> attribBuilder.Add(ViewAttributes.KeyboardAttribKey, (v))
match label with None -> () | Some v -> attribBuilder.Add(ViewAttributes.LabelAttribKey, (v))
match labelColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.LabelColorAttribKey, (v))
match placeholder with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match verticalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VerticalTextAlignmentAttribKey, (v))
match completed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CompletedAttribKey, ViewConverters.makeEntryCellCompletedEventHandler(v))
attribBuilder
static member UpdateXFEntryCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.EntryCell) =
let mutable prevCompletedOpt = ValueNone
let mutable currCompletedOpt = ValueNone
let mutable prevHorizontalTextAlignmentOpt = ValueNone
let mutable currHorizontalTextAlignmentOpt = ValueNone
let mutable prevKeyboardOpt = ValueNone
let mutable currKeyboardOpt = ValueNone
let mutable prevLabelOpt = ValueNone
let mutable currLabelOpt = ValueNone
let mutable prevLabelColorOpt = ValueNone
let mutable currLabelColorOpt = ValueNone
let mutable prevPlaceholderOpt = ValueNone
let mutable currPlaceholderOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevVerticalTextAlignmentOpt = ValueNone
let mutable currVerticalTextAlignmentOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
currCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
currHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.KeyboardAttribKey.KeyValue then
currKeyboardOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Keyboard)
if kvp.Key = ViewAttributes.LabelAttribKey.KeyValue then
currLabelOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.LabelColorAttribKey.KeyValue then
currLabelColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
currPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
currVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
prevCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
prevHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.KeyboardAttribKey.KeyValue then
prevKeyboardOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Keyboard)
if kvp.Key = ViewAttributes.LabelAttribKey.KeyValue then
prevLabelOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.LabelColorAttribKey.KeyValue then
prevLabelColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
prevPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
prevVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
// Unsubscribe previous event handlers
let shouldUpdateCompleted = not ((identical prevCompletedOpt currCompletedOpt))
if shouldUpdateCompleted then
match prevCompletedOpt with
| ValueSome prevValue -> target.Completed.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateCell (prevOpt, curr, target)
// Update properties
match prevHorizontalTextAlignmentOpt, currHorizontalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HorizontalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.HorizontalTextAlignmentProperty
| ValueNone, ValueNone -> ()
match prevKeyboardOpt, currKeyboardOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Keyboard <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.KeyboardProperty
| ValueNone, ValueNone -> ()
match prevLabelOpt, currLabelOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Label <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.LabelProperty
| ValueNone, ValueNone -> ()
match prevLabelColorOpt, currLabelColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.LabelColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.LabelColorProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderOpt, currPlaceholderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Placeholder <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.PlaceholderProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.TextProperty
| ValueNone, ValueNone -> ()
match prevVerticalTextAlignmentOpt, currVerticalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.VerticalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.EntryCell.VerticalTextAlignmentProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCompleted then
match currCompletedOpt with
| ValueSome currValue -> target.Completed.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a EntryCell in the view
static member inline BuildEntryCell(attribCount: int,
?text: string,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?keyboard: Xamarin.Forms.Keyboard,
?label: string,
?labelColor: Xamarin.Forms.Color,
?placeholder: string,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?completed: string -> unit,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildXFEntryCell(attribCount, ?horizontalTextAlignment=horizontalTextAlignment, ?keyboard=keyboard, ?label=label, ?labelColor=labelColor, ?placeholder=placeholder,
?verticalTextAlignment=verticalTextAlignment, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?completed=completed, ?tapped=tapped, ?created=created)
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateEntryCell () : Fabulous.XamarinForms.CustomEntryCell =
new Fabulous.XamarinForms.CustomEntryCell()
static member UpdateEntryCell (prevOpt: ViewElement voption, curr: ViewElement, target: Fabulous.XamarinForms.CustomEntryCell) =
let mutable prevTextChangedOpt = ValueNone
let mutable currTextChangedOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
currTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
prevTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
// Unsubscribe previous event handlers
let shouldUpdateTextChanged = not ((identical prevTextChangedOpt currTextChangedOpt) && (identical prevTextOpt currTextOpt))
if shouldUpdateTextChanged then
match prevTextChangedOpt with
| ValueSome prevValue -> target.TextChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateXFEntryCell (prevOpt, curr, target)
// Update properties
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Fabulous.XamarinForms.CustomEntryCell.TextProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateTextChanged then
match currTextChangedOpt with
| ValueSome currValue -> target.TextChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructEntryCell(?text: string,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?keyboard: Xamarin.Forms.Keyboard,
?label: string,
?labelColor: Xamarin.Forms.Color,
?placeholder: string,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Fabulous.XamarinForms.CustomEntryCell>,
?tag: obj,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?completed: string -> unit,
?tapped: unit -> unit,
?created: (Fabulous.XamarinForms.CustomEntryCell -> unit)) =
let attribBuilder = ViewBuilders.BuildEntryCell(0,
?text=text,
?horizontalTextAlignment=horizontalTextAlignment,
?keyboard=keyboard,
?label=label,
?labelColor=labelColor,
?placeholder=placeholder,
?verticalTextAlignment=verticalTextAlignment,
?contextActions=contextActions,
?height=height,
?isEnabled=isEnabled,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Fabulous.XamarinForms.CustomEntryCell>) -> Some ref.Unbox),
?tag=tag,
?textChanged=textChanged,
?completed=completed,
?tapped=tapped,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Fabulous.XamarinForms.CustomEntryCell> target))))
ViewElement.Create<Fabulous.XamarinForms.CustomEntryCell>(ViewBuilders.CreateEntryCell, (fun prevOpt curr target -> ViewBuilders.UpdateEntryCell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a SwitchCell in the view
static member inline BuildSwitchCell(attribCount: int,
?on: bool,
?onColor: Xamarin.Forms.Color,
?text: string,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?onChanged: Xamarin.Forms.ToggledEventArgs -> unit,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match on with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match onColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match onChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildCell(attribCount, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?tapped=tapped, ?created=created)
match on with None -> () | Some v -> attribBuilder.Add(ViewAttributes.OnAttribKey, (v))
match onColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.OnColorAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match onChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.OnChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.ToggledEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateSwitchCell () : Xamarin.Forms.SwitchCell =
new Xamarin.Forms.SwitchCell()
static member UpdateSwitchCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.SwitchCell) =
let mutable prevOnChangedOpt = ValueNone
let mutable currOnChangedOpt = ValueNone
let mutable prevOnOpt = ValueNone
let mutable currOnOpt = ValueNone
let mutable prevOnColorOpt = ValueNone
let mutable currOnColorOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.OnChangedAttribKey.KeyValue then
currOnChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ToggledEventArgs>)
if kvp.Key = ViewAttributes.OnAttribKey.KeyValue then
currOnOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.OnColorAttribKey.KeyValue then
currOnColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.OnChangedAttribKey.KeyValue then
prevOnChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ToggledEventArgs>)
if kvp.Key = ViewAttributes.OnAttribKey.KeyValue then
prevOnOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.OnColorAttribKey.KeyValue then
prevOnColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
// Unsubscribe previous event handlers
let shouldUpdateOnChanged = not ((identical prevOnChangedOpt currOnChangedOpt) && (identical prevOnOpt currOnOpt))
if shouldUpdateOnChanged then
match prevOnChangedOpt with
| ValueSome prevValue -> target.OnChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateCell (prevOpt, curr, target)
// Update properties
match prevOnOpt, currOnOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.On <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SwitchCell.OnProperty
| ValueNone, ValueNone -> ()
match prevOnColorOpt, currOnColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.OnColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SwitchCell.OnColorProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SwitchCell.TextProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateOnChanged then
match currOnChangedOpt with
| ValueSome currValue -> target.OnChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructSwitchCell(?on: bool,
?onColor: Xamarin.Forms.Color,
?text: string,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.SwitchCell>,
?tag: obj,
?onChanged: Xamarin.Forms.ToggledEventArgs -> unit,
?tapped: unit -> unit,
?created: (Xamarin.Forms.SwitchCell -> unit)) =
let attribBuilder = ViewBuilders.BuildSwitchCell(0,
?on=on,
?onColor=onColor,
?text=text,
?contextActions=contextActions,
?height=height,
?isEnabled=isEnabled,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.SwitchCell>) -> Some ref.Unbox),
?tag=tag,
?onChanged=onChanged,
?tapped=tapped,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.SwitchCell> target))))
ViewElement.Create<Xamarin.Forms.SwitchCell>(ViewBuilders.CreateSwitchCell, (fun prevOpt curr target -> ViewBuilders.UpdateSwitchCell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a TextCell in the view
static member inline BuildTextCell(attribCount: int,
?command: unit -> unit,
?commandCanExecute: bool,
?detail: string,
?detailColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match detail with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match detailColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildCell(attribCount, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?tapped=tapped, ?created=created)
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match detail with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextCellDetailAttribKey, (v))
match detailColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.DetailColorAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
attribBuilder
static member CreateTextCell () : Xamarin.Forms.TextCell =
new Xamarin.Forms.TextCell()
static member UpdateTextCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.TextCell) =
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevTextCellDetailOpt = ValueNone
let mutable currTextCellDetailOpt = ValueNone
let mutable prevDetailColorOpt = ValueNone
let mutable currDetailColorOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextCellDetailAttribKey.KeyValue then
currTextCellDetailOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.DetailColorAttribKey.KeyValue then
currDetailColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextCellDetailAttribKey.KeyValue then
prevTextCellDetailOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.DetailColorAttribKey.KeyValue then
prevDetailColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Update inherited members
ViewBuilders.UpdateCell (prevOpt, curr, target)
// Update properties
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.TextCell) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevTextCellDetailOpt, currTextCellDetailOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Detail <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TextCell.DetailProperty
| ValueNone, ValueNone -> ()
match prevDetailColorOpt, currDetailColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.DetailColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TextCell.DetailColorProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TextCell.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TextCell.TextColorProperty
| ValueNone, ValueNone -> ()
static member inline ConstructTextCell(?command: unit -> unit,
?commandCanExecute: bool,
?detail: string,
?detailColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.TextCell>,
?tag: obj,
?tapped: unit -> unit,
?created: (Xamarin.Forms.TextCell -> unit)) =
let attribBuilder = ViewBuilders.BuildTextCell(0,
?command=command,
?commandCanExecute=commandCanExecute,
?detail=detail,
?detailColor=detailColor,
?text=text,
?textColor=textColor,
?contextActions=contextActions,
?height=height,
?isEnabled=isEnabled,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.TextCell>) -> Some ref.Unbox),
?tag=tag,
?tapped=tapped,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.TextCell> target))))
ViewElement.Create<Xamarin.Forms.TextCell>(ViewBuilders.CreateTextCell, (fun prevOpt curr target -> ViewBuilders.UpdateTextCell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ImageCell in the view
static member inline BuildImageCell(attribCount: int,
?image: Fabulous.XamarinForms.InputTypes.Image,
?command: unit -> unit,
?commandCanExecute: bool,
?detail: string,
?detailColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match image with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildTextCell(attribCount, ?command=command, ?commandCanExecute=commandCanExecute, ?detail=detail, ?detailColor=detailColor, ?text=text,
?textColor=textColor, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?tapped=tapped, ?created=created)
match image with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ImageSourceAttribKey, (v))
attribBuilder
static member CreateImageCell () : Xamarin.Forms.ImageCell =
new Xamarin.Forms.ImageCell()
static member UpdateImageCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ImageCell) =
let mutable prevImageSourceOpt = ValueNone
let mutable currImageSourceOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
currImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
prevImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
// Update inherited members
ViewBuilders.UpdateTextCell (prevOpt, curr, target)
// Update properties
match prevImageSourceOpt, currImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ImageSource <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageCell.ImageSourceProperty
| ValueNone, ValueNone -> ()
static member inline ConstructImageCell(?image: Fabulous.XamarinForms.InputTypes.Image,
?command: unit -> unit,
?commandCanExecute: bool,
?detail: string,
?detailColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ImageCell>,
?tag: obj,
?tapped: unit -> unit,
?created: (Xamarin.Forms.ImageCell -> unit)) =
let attribBuilder = ViewBuilders.BuildImageCell(0,
?image=image,
?command=command,
?commandCanExecute=commandCanExecute,
?detail=detail,
?detailColor=detailColor,
?text=text,
?textColor=textColor,
?contextActions=contextActions,
?height=height,
?isEnabled=isEnabled,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ImageCell>) -> Some ref.Unbox),
?tag=tag,
?tapped=tapped,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ImageCell> target))))
ViewElement.Create<Xamarin.Forms.ImageCell>(ViewBuilders.CreateImageCell, (fun prevOpt curr target -> ViewBuilders.UpdateImageCell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ViewCell in the view
static member inline BuildViewCell(attribCount: int,
?view: ViewElement,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?tapped: unit -> unit,
?created: obj -> unit) =
let attribCount = match view with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildCell(attribCount, ?contextActions=contextActions, ?height=height, ?isEnabled=isEnabled, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?tapped=tapped, ?created=created)
match view with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ViewAttribKey, (v))
attribBuilder
static member CreateViewCell () : Xamarin.Forms.ViewCell =
new Xamarin.Forms.ViewCell()
static member UpdateViewCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ViewCell) =
let mutable prevViewOpt = ValueNone
let mutable currViewOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ViewAttribKey.KeyValue then
currViewOpt <- ValueSome (kvp.Value :?> ViewElement)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ViewAttribKey.KeyValue then
prevViewOpt <- ValueSome (kvp.Value :?> ViewElement)
// Update inherited members
ViewBuilders.UpdateCell (prevOpt, curr, target)
// Update properties
match prevViewOpt, currViewOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.View)
| _, ValueSome newValue ->
target.View <- (newValue.Create() :?> Xamarin.Forms.View)
| ValueSome _, ValueNone ->
target.View <- null
| ValueNone, ValueNone -> ()
static member inline ConstructViewCell(?view: ViewElement,
?contextActions: ViewElement list,
?height: float,
?isEnabled: bool,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ViewCell>,
?tag: obj,
?tapped: unit -> unit,
?created: (Xamarin.Forms.ViewCell -> unit)) =
let attribBuilder = ViewBuilders.BuildViewCell(0,
?view=view,
?contextActions=contextActions,
?height=height,
?isEnabled=isEnabled,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ViewCell>) -> Some ref.Unbox),
?tag=tag,
?tapped=tapped,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ViewCell> target))))
ViewElement.Create<Xamarin.Forms.ViewCell>(ViewBuilders.CreateViewCell, (fun prevOpt curr target -> ViewBuilders.UpdateViewCell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a FormattedString in the view
static member inline BuildFormattedString(attribCount: int,
?spans: ViewElement list,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match spans with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match spans with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SpansAttribKey, Array.ofList(v))
attribBuilder
static member CreateFormattedString () : Xamarin.Forms.FormattedString =
new Xamarin.Forms.FormattedString()
static member UpdateFormattedString (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.FormattedString) =
let mutable prevSpansOpt = ValueNone
let mutable currSpansOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.SpansAttribKey.KeyValue then
currSpansOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.SpansAttribKey.KeyValue then
prevSpansOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateCollectionGeneric prevSpansOpt currSpansOpt target.Spans
(fun (x:ViewElement) -> x.Create() :?> Xamarin.Forms.Span)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
static member inline ConstructFormattedString(?spans: ViewElement list,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.FormattedString>,
?tag: obj,
?created: (Xamarin.Forms.FormattedString -> unit)) =
let attribBuilder = ViewBuilders.BuildFormattedString(0,
?spans=spans,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.FormattedString>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.FormattedString> target))))
ViewElement.Create<Xamarin.Forms.FormattedString>(ViewBuilders.CreateFormattedString, (fun prevOpt curr target -> ViewBuilders.UpdateFormattedString(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a GestureElement in the view
static member inline BuildGestureElement(attribCount: int,
?gestureRecognizers: ViewElement list,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match gestureRecognizers with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match gestureRecognizers with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GestureRecognizersAttribKey, Array.ofList(v))
attribBuilder
static member UpdateGestureElement (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.GestureElement) =
let mutable prevGestureRecognizersOpt = ValueNone
let mutable currGestureRecognizersOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.GestureRecognizersAttribKey.KeyValue then
currGestureRecognizersOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.GestureRecognizersAttribKey.KeyValue then
prevGestureRecognizersOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateCollectionGeneric prevGestureRecognizersOpt currGestureRecognizersOpt target.GestureRecognizers
(fun (x:ViewElement) -> x.Create() :?> Xamarin.Forms.IGestureRecognizer)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
/// Builds the attributes for a Span in the view
static member inline BuildSpan(attribCount: int,
?characterSpacing: float,
?backgroundColor: Xamarin.Forms.Color,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?foregroundColor: Xamarin.Forms.Color,
?lineHeight: float,
?style: Xamarin.Forms.Style,
?text: string,
?textColor: Xamarin.Forms.Color,
?textDecorations: Xamarin.Forms.TextDecorations,
?gestureRecognizers: ViewElement list,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match backgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match foregroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match lineHeight with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match style with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textDecorations with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildGestureElement(attribCount, ?gestureRecognizers=gestureRecognizers, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu,
?styleId=styleId, ?ref=ref, ?tag=tag, ?created=created)
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match backgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BackgroundColorAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match foregroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ForegroundColorAttribKey, (v))
match lineHeight with None -> () | Some v -> attribBuilder.Add(ViewAttributes.LineHeightAttribKey, (v))
match style with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StyleAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
match textDecorations with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextDecorationsAttribKey, (v))
attribBuilder
static member CreateSpan () : Xamarin.Forms.Span =
new Xamarin.Forms.Span()
static member UpdateSpan (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Span) =
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevBackgroundColorOpt = ValueNone
let mutable currBackgroundColorOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevForegroundColorOpt = ValueNone
let mutable currForegroundColorOpt = ValueNone
let mutable prevLineHeightOpt = ValueNone
let mutable currLineHeightOpt = ValueNone
let mutable prevStyleOpt = ValueNone
let mutable currStyleOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
let mutable prevTextDecorationsOpt = ValueNone
let mutable currTextDecorationsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.BackgroundColorAttribKey.KeyValue then
currBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.ForegroundColorAttribKey.KeyValue then
currForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.LineHeightAttribKey.KeyValue then
currLineHeightOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.StyleAttribKey.KeyValue then
currStyleOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextDecorationsAttribKey.KeyValue then
currTextDecorationsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextDecorations)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.BackgroundColorAttribKey.KeyValue then
prevBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.ForegroundColorAttribKey.KeyValue then
prevForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.LineHeightAttribKey.KeyValue then
prevLineHeightOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.StyleAttribKey.KeyValue then
prevStyleOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextDecorationsAttribKey.KeyValue then
prevTextDecorationsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextDecorations)
// Update inherited members
ViewBuilders.UpdateGestureElement (prevOpt, curr, target)
// Update properties
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
match prevBackgroundColorOpt, currBackgroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BackgroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.BackgroundColorProperty
| ValueNone, ValueNone -> ()
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevForegroundColorOpt, currForegroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ForegroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.ForegroundColorProperty
| ValueNone, ValueNone -> ()
match prevLineHeightOpt, currLineHeightOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.LineHeight <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.LineHeightProperty
| ValueNone, ValueNone -> ()
match prevStyleOpt, currStyleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Style <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.StyleProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.TextColorProperty
| ValueNone, ValueNone -> ()
match prevTextDecorationsOpt, currTextDecorationsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextDecorations <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Span.TextDecorationsProperty
| ValueNone, ValueNone -> ()
static member inline ConstructSpan(?characterSpacing: float,
?backgroundColor: Xamarin.Forms.Color,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?foregroundColor: Xamarin.Forms.Color,
?lineHeight: float,
?style: Xamarin.Forms.Style,
?text: string,
?textColor: Xamarin.Forms.Color,
?textDecorations: Xamarin.Forms.TextDecorations,
?gestureRecognizers: ViewElement list,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Span>,
?tag: obj,
?created: (Xamarin.Forms.Span -> unit)) =
let attribBuilder = ViewBuilders.BuildSpan(0,
?characterSpacing=characterSpacing,
?backgroundColor=backgroundColor,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?foregroundColor=foregroundColor,
?lineHeight=lineHeight,
?style=style,
?text=text,
?textColor=textColor,
?textDecorations=textDecorations,
?gestureRecognizers=gestureRecognizers,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Span>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Span> target))))
ViewElement.Create<Xamarin.Forms.Span>(ViewBuilders.CreateSpan, (fun prevOpt curr target -> ViewBuilders.UpdateSpan(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ClickGestureRecognizer in the view
static member inline BuildClickGestureRecognizer(attribCount: int,
?buttons: Xamarin.Forms.ButtonsMask,
?command: unit -> unit,
?commandCanExecute: bool,
?numberOfClicksRequired: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match buttons with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match numberOfClicksRequired with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match buttons with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ButtonsAttribKey, (v))
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match numberOfClicksRequired with None -> () | Some v -> attribBuilder.Add(ViewAttributes.NumberOfClicksRequiredAttribKey, (v))
attribBuilder
static member CreateClickGestureRecognizer () : Xamarin.Forms.ClickGestureRecognizer =
new Xamarin.Forms.ClickGestureRecognizer()
static member UpdateClickGestureRecognizer (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ClickGestureRecognizer) =
let mutable prevButtonsOpt = ValueNone
let mutable currButtonsOpt = ValueNone
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevNumberOfClicksRequiredOpt = ValueNone
let mutable currNumberOfClicksRequiredOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ButtonsAttribKey.KeyValue then
currButtonsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ButtonsMask)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.NumberOfClicksRequiredAttribKey.KeyValue then
currNumberOfClicksRequiredOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ButtonsAttribKey.KeyValue then
prevButtonsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ButtonsMask)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.NumberOfClicksRequiredAttribKey.KeyValue then
prevNumberOfClicksRequiredOpt <- ValueSome (kvp.Value :?> int)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
match prevButtonsOpt, currButtonsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Buttons <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ClickGestureRecognizer.ButtonsProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.ClickGestureRecognizer) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevNumberOfClicksRequiredOpt, currNumberOfClicksRequiredOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.NumberOfClicksRequired <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ClickGestureRecognizer.NumberOfClicksRequiredProperty
| ValueNone, ValueNone -> ()
static member inline ConstructClickGestureRecognizer(?buttons: Xamarin.Forms.ButtonsMask,
?command: unit -> unit,
?commandCanExecute: bool,
?numberOfClicksRequired: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ClickGestureRecognizer>,
?tag: obj,
?created: (Xamarin.Forms.ClickGestureRecognizer -> unit)) =
let attribBuilder = ViewBuilders.BuildClickGestureRecognizer(0,
?buttons=buttons,
?command=command,
?commandCanExecute=commandCanExecute,
?numberOfClicksRequired=numberOfClicksRequired,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ClickGestureRecognizer>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ClickGestureRecognizer> target))))
ViewElement.Create<Xamarin.Forms.ClickGestureRecognizer>(ViewBuilders.CreateClickGestureRecognizer, (fun prevOpt curr target -> ViewBuilders.UpdateClickGestureRecognizer(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a PanGestureRecognizer in the view
static member inline BuildPanGestureRecognizer(attribCount: int,
?touchPoints: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?panUpdated: Xamarin.Forms.PanUpdatedEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match touchPoints with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match panUpdated with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match touchPoints with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TouchPointsAttribKey, (v))
match panUpdated with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PanUpdatedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.PanUpdatedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreatePanGestureRecognizer () : Xamarin.Forms.PanGestureRecognizer =
new Xamarin.Forms.PanGestureRecognizer()
static member UpdatePanGestureRecognizer (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.PanGestureRecognizer) =
let mutable prevPanUpdatedOpt = ValueNone
let mutable currPanUpdatedOpt = ValueNone
let mutable prevTouchPointsOpt = ValueNone
let mutable currTouchPointsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.PanUpdatedAttribKey.KeyValue then
currPanUpdatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PanUpdatedEventArgs>)
if kvp.Key = ViewAttributes.TouchPointsAttribKey.KeyValue then
currTouchPointsOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.PanUpdatedAttribKey.KeyValue then
prevPanUpdatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PanUpdatedEventArgs>)
if kvp.Key = ViewAttributes.TouchPointsAttribKey.KeyValue then
prevTouchPointsOpt <- ValueSome (kvp.Value :?> int)
// Unsubscribe previous event handlers
let shouldUpdatePanUpdated = not ((identical prevPanUpdatedOpt currPanUpdatedOpt))
if shouldUpdatePanUpdated then
match prevPanUpdatedOpt with
| ValueSome prevValue -> target.PanUpdated.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
match prevTouchPointsOpt, currTouchPointsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TouchPoints <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.PanGestureRecognizer.TouchPointsProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdatePanUpdated then
match currPanUpdatedOpt with
| ValueSome currValue -> target.PanUpdated.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructPanGestureRecognizer(?touchPoints: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.PanGestureRecognizer>,
?tag: obj,
?panUpdated: Xamarin.Forms.PanUpdatedEventArgs -> unit,
?created: (Xamarin.Forms.PanGestureRecognizer -> unit)) =
let attribBuilder = ViewBuilders.BuildPanGestureRecognizer(0,
?touchPoints=touchPoints,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.PanGestureRecognizer>) -> Some ref.Unbox),
?tag=tag,
?panUpdated=panUpdated,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.PanGestureRecognizer> target))))
ViewElement.Create<Xamarin.Forms.PanGestureRecognizer>(ViewBuilders.CreatePanGestureRecognizer, (fun prevOpt curr target -> ViewBuilders.UpdatePanGestureRecognizer(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a PinchGestureRecognizer in the view
static member inline BuildPinchGestureRecognizer(attribCount: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?pinchUpdated: Xamarin.Forms.PinchGestureUpdatedEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match pinchUpdated with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match pinchUpdated with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PinchUpdatedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.PinchGestureUpdatedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreatePinchGestureRecognizer () : Xamarin.Forms.PinchGestureRecognizer =
new Xamarin.Forms.PinchGestureRecognizer()
static member UpdatePinchGestureRecognizer (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.PinchGestureRecognizer) =
let mutable prevPinchUpdatedOpt = ValueNone
let mutable currPinchUpdatedOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.PinchUpdatedAttribKey.KeyValue then
currPinchUpdatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PinchGestureUpdatedEventArgs>)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.PinchUpdatedAttribKey.KeyValue then
prevPinchUpdatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PinchGestureUpdatedEventArgs>)
// Unsubscribe previous event handlers
let shouldUpdatePinchUpdated = not ((identical prevPinchUpdatedOpt currPinchUpdatedOpt))
if shouldUpdatePinchUpdated then
match prevPinchUpdatedOpt with
| ValueSome prevValue -> target.PinchUpdated.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Subscribe new event handlers
if shouldUpdatePinchUpdated then
match currPinchUpdatedOpt with
| ValueSome currValue -> target.PinchUpdated.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructPinchGestureRecognizer(?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.PinchGestureRecognizer>,
?tag: obj,
?pinchUpdated: Xamarin.Forms.PinchGestureUpdatedEventArgs -> unit,
?created: (Xamarin.Forms.PinchGestureRecognizer -> unit)) =
let attribBuilder = ViewBuilders.BuildPinchGestureRecognizer(0,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.PinchGestureRecognizer>) -> Some ref.Unbox),
?tag=tag,
?pinchUpdated=pinchUpdated,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.PinchGestureRecognizer> target))))
ViewElement.Create<Xamarin.Forms.PinchGestureRecognizer>(ViewBuilders.CreatePinchGestureRecognizer, (fun prevOpt curr target -> ViewBuilders.UpdatePinchGestureRecognizer(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a SwipeGestureRecognizer in the view
static member inline BuildSwipeGestureRecognizer(attribCount: int,
?command: unit -> unit,
?commandCanExecute: bool,
?direction: Xamarin.Forms.SwipeDirection,
?threshold: uint32,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match direction with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match threshold with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match direction with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SwipeGestureRecognizerDirectionAttribKey, (v))
match threshold with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ThresholdAttribKey, (v))
attribBuilder
static member CreateSwipeGestureRecognizer () : Xamarin.Forms.SwipeGestureRecognizer =
new Xamarin.Forms.SwipeGestureRecognizer()
static member UpdateSwipeGestureRecognizer (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.SwipeGestureRecognizer) =
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevSwipeGestureRecognizerDirectionOpt = ValueNone
let mutable currSwipeGestureRecognizerDirectionOpt = ValueNone
let mutable prevThresholdOpt = ValueNone
let mutable currThresholdOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.SwipeGestureRecognizerDirectionAttribKey.KeyValue then
currSwipeGestureRecognizerDirectionOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.SwipeDirection)
if kvp.Key = ViewAttributes.ThresholdAttribKey.KeyValue then
currThresholdOpt <- ValueSome (kvp.Value :?> uint32)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.SwipeGestureRecognizerDirectionAttribKey.KeyValue then
prevSwipeGestureRecognizerDirectionOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.SwipeDirection)
if kvp.Key = ViewAttributes.ThresholdAttribKey.KeyValue then
prevThresholdOpt <- ValueSome (kvp.Value :?> uint32)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.SwipeGestureRecognizer) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevSwipeGestureRecognizerDirectionOpt, currSwipeGestureRecognizerDirectionOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Direction <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SwipeGestureRecognizer.DirectionProperty
| ValueNone, ValueNone -> ()
match prevThresholdOpt, currThresholdOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Threshold <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SwipeGestureRecognizer.ThresholdProperty
| ValueNone, ValueNone -> ()
static member inline ConstructSwipeGestureRecognizer(?command: unit -> unit,
?commandCanExecute: bool,
?direction: Xamarin.Forms.SwipeDirection,
?threshold: uint32,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.SwipeGestureRecognizer>,
?tag: obj,
?created: (Xamarin.Forms.SwipeGestureRecognizer -> unit)) =
let attribBuilder = ViewBuilders.BuildSwipeGestureRecognizer(0,
?command=command,
?commandCanExecute=commandCanExecute,
?direction=direction,
?threshold=threshold,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.SwipeGestureRecognizer>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.SwipeGestureRecognizer> target))))
ViewElement.Create<Xamarin.Forms.SwipeGestureRecognizer>(ViewBuilders.CreateSwipeGestureRecognizer, (fun prevOpt curr target -> ViewBuilders.UpdateSwipeGestureRecognizer(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a TapGestureRecognizer in the view
static member inline BuildTapGestureRecognizer(attribCount: int,
?command: unit -> unit,
?commandCanExecute: bool,
?numberOfTapsRequired: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match numberOfTapsRequired with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match numberOfTapsRequired with None -> () | Some v -> attribBuilder.Add(ViewAttributes.NumberOfTapsRequiredAttribKey, (v))
attribBuilder
static member CreateTapGestureRecognizer () : Xamarin.Forms.TapGestureRecognizer =
new Xamarin.Forms.TapGestureRecognizer()
static member UpdateTapGestureRecognizer (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.TapGestureRecognizer) =
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevNumberOfTapsRequiredOpt = ValueNone
let mutable currNumberOfTapsRequiredOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.NumberOfTapsRequiredAttribKey.KeyValue then
currNumberOfTapsRequiredOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.NumberOfTapsRequiredAttribKey.KeyValue then
prevNumberOfTapsRequiredOpt <- ValueSome (kvp.Value :?> int)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.TapGestureRecognizer) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevNumberOfTapsRequiredOpt, currNumberOfTapsRequiredOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.NumberOfTapsRequired <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TapGestureRecognizer.NumberOfTapsRequiredProperty
| ValueNone, ValueNone -> ()
static member inline ConstructTapGestureRecognizer(?command: unit -> unit,
?commandCanExecute: bool,
?numberOfTapsRequired: int,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.TapGestureRecognizer>,
?tag: obj,
?created: (Xamarin.Forms.TapGestureRecognizer -> unit)) =
let attribBuilder = ViewBuilders.BuildTapGestureRecognizer(0,
?command=command,
?commandCanExecute=commandCanExecute,
?numberOfTapsRequired=numberOfTapsRequired,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.TapGestureRecognizer>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.TapGestureRecognizer> target))))
ViewElement.Create<Xamarin.Forms.TapGestureRecognizer>(ViewBuilders.CreateTapGestureRecognizer, (fun prevOpt curr target -> ViewBuilders.UpdateTapGestureRecognizer(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a FontImageSource in the view
static member inline BuildFontImageSource(attribCount: int,
?color: Xamarin.Forms.Color,
?fontFamily: string,
?glyph: string,
?size: float,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match color with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match glyph with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match size with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match color with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ColorAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match glyph with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GlyphAttribKey, (v))
match size with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SizeAttribKey, (v))
attribBuilder
static member CreateFontImageSource () : Xamarin.Forms.FontImageSource =
new Xamarin.Forms.FontImageSource()
static member UpdateFontImageSource (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.FontImageSource) =
let mutable prevColorOpt = ValueNone
let mutable currColorOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevGlyphOpt = ValueNone
let mutable currGlyphOpt = ValueNone
let mutable prevSizeOpt = ValueNone
let mutable currSizeOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
currColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.GlyphAttribKey.KeyValue then
currGlyphOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.SizeAttribKey.KeyValue then
currSizeOpt <- ValueSome (kvp.Value :?> float)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
prevColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.GlyphAttribKey.KeyValue then
prevGlyphOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.SizeAttribKey.KeyValue then
prevSizeOpt <- ValueSome (kvp.Value :?> float)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
match prevColorOpt, currColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Color <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.FontImageSource.ColorProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.FontImageSource.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevGlyphOpt, currGlyphOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Glyph <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.FontImageSource.GlyphProperty
| ValueNone, ValueNone -> ()
match prevSizeOpt, currSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Size <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.FontImageSource.SizeProperty
| ValueNone, ValueNone -> ()
static member inline ConstructFontImageSource(?color: Xamarin.Forms.Color,
?fontFamily: string,
?glyph: string,
?size: float,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.FontImageSource>,
?tag: obj,
?created: (Xamarin.Forms.FontImageSource -> unit)) =
let attribBuilder = ViewBuilders.BuildFontImageSource(0,
?color=color,
?fontFamily=fontFamily,
?glyph=glyph,
?size=size,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.FontImageSource>) -> Some ref.Unbox),
?tag=tag,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.FontImageSource> target))))
ViewElement.Create<Xamarin.Forms.FontImageSource>(ViewBuilders.CreateFontImageSource, (fun prevOpt curr target -> ViewBuilders.UpdateFontImageSource(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a NavigableElement in the view
static member inline BuildNavigableElement(attribCount: int,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?created: obj -> unit) =
let attribCount = match style with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match styleClasses with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellBackButtonBehavior with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellBackgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellDisabledColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellForegroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellFlyoutBehavior with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellNavBarIsVisible with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellSearchHandler with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarBackgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarDisabledColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarForegroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarIsVisible with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarTitleColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTabBarUnselectedColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTitleColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellTitleView with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match shellUnselectedColor with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildElement(attribCount, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?created=created)
match style with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StyleAttribKey, (v))
match styleClasses with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StyleClassAttribKey, Array.ofList(v))
match shellBackButtonBehavior with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellBackButtonBehaviorAttribKey, (v))
match shellBackgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellBackgroundColorAttribKey, (v))
match shellDisabledColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellDisabledColorAttribKey, (v))
match shellForegroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellForegroundColorAttribKey, (v))
match shellFlyoutBehavior with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellFlyoutBehaviorAttribKey, (v))
match shellNavBarIsVisible with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellNavBarIsVisibleAttribKey, (v))
match shellSearchHandler with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellSearchHandlerAttribKey, (v))
match shellTabBarBackgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarBackgroundColorAttribKey, (v))
match shellTabBarDisabledColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarDisabledColorAttribKey, (v))
match shellTabBarForegroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarForegroundColorAttribKey, (v))
match shellTabBarIsVisible with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarIsVisibleAttribKey, (v))
match shellTabBarTitleColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarTitleColorAttribKey, (v))
match shellTabBarUnselectedColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTabBarUnselectedColorAttribKey, (v))
match shellTitleColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTitleColorAttribKey, (v))
match shellTitleView with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellTitleViewAttribKey, (v))
match shellUnselectedColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellUnselectedColorAttribKey, (v))
attribBuilder
static member UpdateNavigableElement (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.NavigableElement) =
let mutable prevStyleOpt = ValueNone
let mutable currStyleOpt = ValueNone
let mutable prevStyleClassOpt = ValueNone
let mutable currStyleClassOpt = ValueNone
let mutable prevShellBackButtonBehaviorOpt = ValueNone
let mutable currShellBackButtonBehaviorOpt = ValueNone
let mutable prevShellBackgroundColorOpt = ValueNone
let mutable currShellBackgroundColorOpt = ValueNone
let mutable prevShellDisabledColorOpt = ValueNone
let mutable currShellDisabledColorOpt = ValueNone
let mutable prevShellForegroundColorOpt = ValueNone
let mutable currShellForegroundColorOpt = ValueNone
let mutable prevShellFlyoutBehaviorOpt = ValueNone
let mutable currShellFlyoutBehaviorOpt = ValueNone
let mutable prevShellNavBarIsVisibleOpt = ValueNone
let mutable currShellNavBarIsVisibleOpt = ValueNone
let mutable prevShellSearchHandlerOpt = ValueNone
let mutable currShellSearchHandlerOpt = ValueNone
let mutable prevShellTabBarBackgroundColorOpt = ValueNone
let mutable currShellTabBarBackgroundColorOpt = ValueNone
let mutable prevShellTabBarDisabledColorOpt = ValueNone
let mutable currShellTabBarDisabledColorOpt = ValueNone
let mutable prevShellTabBarForegroundColorOpt = ValueNone
let mutable currShellTabBarForegroundColorOpt = ValueNone
let mutable prevShellTabBarIsVisibleOpt = ValueNone
let mutable currShellTabBarIsVisibleOpt = ValueNone
let mutable prevShellTabBarTitleColorOpt = ValueNone
let mutable currShellTabBarTitleColorOpt = ValueNone
let mutable prevShellTabBarUnselectedColorOpt = ValueNone
let mutable currShellTabBarUnselectedColorOpt = ValueNone
let mutable prevShellTitleColorOpt = ValueNone
let mutable currShellTitleColorOpt = ValueNone
let mutable prevShellTitleViewOpt = ValueNone
let mutable currShellTitleViewOpt = ValueNone
let mutable prevShellUnselectedColorOpt = ValueNone
let mutable currShellUnselectedColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.StyleAttribKey.KeyValue then
currStyleOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style)
if kvp.Key = ViewAttributes.StyleClassAttribKey.KeyValue then
currStyleClassOpt <- ValueSome (kvp.Value :?> string array)
if kvp.Key = ViewAttributes.ShellBackButtonBehaviorAttribKey.KeyValue then
currShellBackButtonBehaviorOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellBackgroundColorAttribKey.KeyValue then
currShellBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellDisabledColorAttribKey.KeyValue then
currShellDisabledColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellForegroundColorAttribKey.KeyValue then
currShellForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellFlyoutBehaviorAttribKey.KeyValue then
currShellFlyoutBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutBehavior)
if kvp.Key = ViewAttributes.ShellNavBarIsVisibleAttribKey.KeyValue then
currShellNavBarIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ShellSearchHandlerAttribKey.KeyValue then
currShellSearchHandlerOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellTabBarBackgroundColorAttribKey.KeyValue then
currShellTabBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarDisabledColorAttribKey.KeyValue then
currShellTabBarDisabledColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarForegroundColorAttribKey.KeyValue then
currShellTabBarForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarIsVisibleAttribKey.KeyValue then
currShellTabBarIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ShellTabBarTitleColorAttribKey.KeyValue then
currShellTabBarTitleColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarUnselectedColorAttribKey.KeyValue then
currShellTabBarUnselectedColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTitleColorAttribKey.KeyValue then
currShellTitleColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTitleViewAttribKey.KeyValue then
currShellTitleViewOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellUnselectedColorAttribKey.KeyValue then
currShellUnselectedColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.StyleAttribKey.KeyValue then
prevStyleOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style)
if kvp.Key = ViewAttributes.StyleClassAttribKey.KeyValue then
prevStyleClassOpt <- ValueSome (kvp.Value :?> string array)
if kvp.Key = ViewAttributes.ShellBackButtonBehaviorAttribKey.KeyValue then
prevShellBackButtonBehaviorOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellBackgroundColorAttribKey.KeyValue then
prevShellBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellDisabledColorAttribKey.KeyValue then
prevShellDisabledColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellForegroundColorAttribKey.KeyValue then
prevShellForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellFlyoutBehaviorAttribKey.KeyValue then
prevShellFlyoutBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutBehavior)
if kvp.Key = ViewAttributes.ShellNavBarIsVisibleAttribKey.KeyValue then
prevShellNavBarIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ShellSearchHandlerAttribKey.KeyValue then
prevShellSearchHandlerOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellTabBarBackgroundColorAttribKey.KeyValue then
prevShellTabBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarDisabledColorAttribKey.KeyValue then
prevShellTabBarDisabledColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarForegroundColorAttribKey.KeyValue then
prevShellTabBarForegroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarIsVisibleAttribKey.KeyValue then
prevShellTabBarIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ShellTabBarTitleColorAttribKey.KeyValue then
prevShellTabBarTitleColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTabBarUnselectedColorAttribKey.KeyValue then
prevShellTabBarUnselectedColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTitleColorAttribKey.KeyValue then
prevShellTitleColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ShellTitleViewAttribKey.KeyValue then
prevShellTitleViewOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ShellUnselectedColorAttribKey.KeyValue then
prevShellUnselectedColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Update inherited members
ViewBuilders.UpdateElement (prevOpt, curr, target)
// Update properties
match prevStyleOpt, currStyleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Style <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.NavigableElement.StyleProperty
| ValueNone, ValueNone -> ()
match prevStyleClassOpt, currStyleClassOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.StyleClass <- currValue
| ValueSome _, ValueNone -> target.StyleClass <- null
| ValueNone, ValueNone -> ()
ViewUpdaters.updateShellBackButtonBehavior prevShellBackButtonBehaviorOpt currShellBackButtonBehaviorOpt target
ViewUpdaters.updateShellBackgroundColor prevShellBackgroundColorOpt currShellBackgroundColorOpt target
ViewUpdaters.updateShellDisabledColor prevShellDisabledColorOpt currShellDisabledColorOpt target
ViewUpdaters.updateShellForegroundColor prevShellForegroundColorOpt currShellForegroundColorOpt target
ViewUpdaters.updateShellFlyoutBehavior prevShellFlyoutBehaviorOpt currShellFlyoutBehaviorOpt target
ViewUpdaters.updateShellNavBarIsVisible prevShellNavBarIsVisibleOpt currShellNavBarIsVisibleOpt target
ViewUpdaters.updatePageShellSearchHandler prevShellSearchHandlerOpt currShellSearchHandlerOpt target
ViewUpdaters.updateShellTabBarBackgroundColor prevShellTabBarBackgroundColorOpt currShellTabBarBackgroundColorOpt target
ViewUpdaters.updateShellTabBarDisabledColor prevShellTabBarDisabledColorOpt currShellTabBarDisabledColorOpt target
ViewUpdaters.updateShellTabBarForegroundColor prevShellTabBarForegroundColorOpt currShellTabBarForegroundColorOpt target
ViewUpdaters.updateShellTabBarIsVisible prevShellTabBarIsVisibleOpt currShellTabBarIsVisibleOpt target
ViewUpdaters.updateShellTabBarTitleColor prevShellTabBarTitleColorOpt currShellTabBarTitleColorOpt target
ViewUpdaters.updateShellTabBarUnselectedColor prevShellTabBarUnselectedColorOpt currShellTabBarUnselectedColorOpt target
ViewUpdaters.updateShellTitleColor prevShellTitleColorOpt currShellTitleColorOpt target
ViewUpdaters.updateShellTitleView prevShellTitleViewOpt currShellTitleViewOpt target
ViewUpdaters.updateShellUnselectedColor prevShellUnselectedColorOpt currShellUnselectedColorOpt target
/// Builds the attributes for a BaseShellItem in the view
static member inline BuildBaseShellItem(attribCount: int,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribCount = match flyoutIcon with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match icon with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isTabStop with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match route with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match tabIndex with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match title with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match appearing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match disappearing with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildNavigableElement(attribCount, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?created=created)
match flyoutIcon with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutIconAttribKey, (v))
match icon with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IconAttribKey, (v))
match isEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsEnabledAttribKey, (v))
match isTabStop with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsTabStopAttribKey, (v))
match route with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RouteAttribKey, (v))
match tabIndex with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TabIndexAttribKey, (v))
match title with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TitleAttribKey, (v))
match appearing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AppearingAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
match disappearing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.DisappearingAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
attribBuilder
static member UpdateBaseShellItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.BaseShellItem) =
let mutable prevAppearingOpt = ValueNone
let mutable currAppearingOpt = ValueNone
let mutable prevDisappearingOpt = ValueNone
let mutable currDisappearingOpt = ValueNone
let mutable prevFlyoutIconOpt = ValueNone
let mutable currFlyoutIconOpt = ValueNone
let mutable prevIconOpt = ValueNone
let mutable currIconOpt = ValueNone
let mutable prevIsEnabledOpt = ValueNone
let mutable currIsEnabledOpt = ValueNone
let mutable prevIsTabStopOpt = ValueNone
let mutable currIsTabStopOpt = ValueNone
let mutable prevRouteOpt = ValueNone
let mutable currRouteOpt = ValueNone
let mutable prevTabIndexOpt = ValueNone
let mutable currTabIndexOpt = ValueNone
let mutable prevTitleOpt = ValueNone
let mutable currTitleOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.AppearingAttribKey.KeyValue then
currAppearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.DisappearingAttribKey.KeyValue then
currDisappearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.FlyoutIconAttribKey.KeyValue then
currFlyoutIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IconAttribKey.KeyValue then
currIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
currIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTabStopAttribKey.KeyValue then
currIsTabStopOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.RouteAttribKey.KeyValue then
currRouteOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TabIndexAttribKey.KeyValue then
currTabIndexOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TitleAttribKey.KeyValue then
currTitleOpt <- ValueSome (kvp.Value :?> string)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.AppearingAttribKey.KeyValue then
prevAppearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.DisappearingAttribKey.KeyValue then
prevDisappearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.FlyoutIconAttribKey.KeyValue then
prevFlyoutIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IconAttribKey.KeyValue then
prevIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
prevIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTabStopAttribKey.KeyValue then
prevIsTabStopOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.RouteAttribKey.KeyValue then
prevRouteOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TabIndexAttribKey.KeyValue then
prevTabIndexOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TitleAttribKey.KeyValue then
prevTitleOpt <- ValueSome (kvp.Value :?> string)
// Unsubscribe previous event handlers
let shouldUpdateAppearing = not ((identical prevAppearingOpt currAppearingOpt))
if shouldUpdateAppearing then
match prevAppearingOpt with
| ValueSome prevValue -> target.Appearing.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateDisappearing = not ((identical prevDisappearingOpt currDisappearingOpt))
if shouldUpdateDisappearing then
match prevDisappearingOpt with
| ValueSome prevValue -> target.Disappearing.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateNavigableElement (prevOpt, curr, target)
// Update properties
match prevFlyoutIconOpt, currFlyoutIconOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutIcon <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.FlyoutIconProperty
| ValueNone, ValueNone -> ()
match prevIconOpt, currIconOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Icon <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.IconProperty
| ValueNone, ValueNone -> ()
match prevIsEnabledOpt, currIsEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.IsEnabledProperty
| ValueNone, ValueNone -> ()
match prevIsTabStopOpt, currIsTabStopOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsTabStop <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.IsTabStopProperty
| ValueNone, ValueNone -> ()
match prevRouteOpt, currRouteOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Route <- currValue
| ValueSome _, ValueNone -> target.Route <- null
| ValueNone, ValueNone -> ()
match prevTabIndexOpt, currTabIndexOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TabIndex <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.TabIndexProperty
| ValueNone, ValueNone -> ()
match prevTitleOpt, currTitleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Title <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BaseShellItem.TitleProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateAppearing then
match currAppearingOpt with
| ValueSome currValue -> target.Appearing.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateDisappearing then
match currDisappearingOpt with
| ValueSome currValue -> target.Disappearing.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a ShellContent in the view
static member inline BuildShellContent(attribCount: int,
?content: ViewElement,
?menuItems: ViewElement list,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribCount = match content with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match menuItems with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBaseShellItem(attribCount, ?flyoutIcon=flyoutIcon, ?icon=icon, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?route=route,
?tabIndex=tabIndex, ?title=title, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?appearing=appearing, ?disappearing=disappearing, ?created=created)
match content with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ContentTemplateAttribKey, (v))
match menuItems with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MenuItemsAttribKey, Array.ofList(v))
attribBuilder
static member CreateShellContent () : Xamarin.Forms.ShellContent =
new Xamarin.Forms.ShellContent()
static member UpdateShellContent (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ShellContent) =
let mutable prevContentTemplateOpt = ValueNone
let mutable currContentTemplateOpt = ValueNone
let mutable prevMenuItemsOpt = ValueNone
let mutable currMenuItemsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ContentTemplateAttribKey.KeyValue then
currContentTemplateOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.MenuItemsAttribKey.KeyValue then
currMenuItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ContentTemplateAttribKey.KeyValue then
prevContentTemplateOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.MenuItemsAttribKey.KeyValue then
prevMenuItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdateBaseShellItem (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateShellContentContentTemplate prevContentTemplateOpt currContentTemplateOpt target
ViewUpdaters.updateShellContentMenuItems prevMenuItemsOpt currMenuItemsOpt target
static member inline ConstructShellContent(?content: ViewElement,
?menuItems: ViewElement list,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ShellContent>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.ShellContent -> unit)) =
let attribBuilder = ViewBuilders.BuildShellContent(0,
?content=content,
?menuItems=menuItems,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ShellContent>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ShellContent> target))))
ViewElement.Create<Xamarin.Forms.ShellContent>(ViewBuilders.CreateShellContent, (fun prevOpt curr target -> ViewBuilders.UpdateShellContent(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ShellGroupItem in the view
static member inline BuildShellGroupItem(attribCount: int,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribCount = match flyoutDisplayOptions with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildBaseShellItem(attribCount, ?flyoutIcon=flyoutIcon, ?icon=icon, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?route=route,
?tabIndex=tabIndex, ?title=title, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?appearing=appearing, ?disappearing=disappearing, ?created=created)
match flyoutDisplayOptions with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutDisplayOptionsAttribKey, (v))
attribBuilder
static member UpdateShellGroupItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ShellGroupItem) =
let mutable prevFlyoutDisplayOptionsOpt = ValueNone
let mutable currFlyoutDisplayOptionsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.FlyoutDisplayOptionsAttribKey.KeyValue then
currFlyoutDisplayOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutDisplayOptions)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.FlyoutDisplayOptionsAttribKey.KeyValue then
prevFlyoutDisplayOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutDisplayOptions)
// Update inherited members
ViewBuilders.UpdateBaseShellItem (prevOpt, curr, target)
// Update properties
match prevFlyoutDisplayOptionsOpt, currFlyoutDisplayOptionsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutDisplayOptions <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ShellGroupItem.FlyoutDisplayOptionsProperty
| ValueNone, ValueNone -> ()
/// Builds the attributes for a ShellItem in the view
static member inline BuildShellItem(attribCount: int,
?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribCount = match currentItem with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match items with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildShellGroupItem(attribCount, ?flyoutDisplayOptions=flyoutDisplayOptions, ?flyoutIcon=flyoutIcon, ?icon=icon, ?isEnabled=isEnabled, ?isTabStop=isTabStop,
?route=route, ?tabIndex=tabIndex, ?title=title, ?style=style, ?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu,
?styleId=styleId, ?ref=ref, ?tag=tag, ?appearing=appearing, ?disappearing=disappearing,
?created=created)
match currentItem with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellItemCurrentItemAttribKey, (v))
match items with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsAttribKey, Array.ofList(v))
attribBuilder
static member CreateShellItem () : Xamarin.Forms.ShellItem =
new Xamarin.Forms.ShellItem()
static member UpdateShellItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ShellItem) =
let mutable prevShellItemCurrentItemOpt = ValueNone
let mutable currShellItemCurrentItemOpt = ValueNone
let mutable prevItemsOpt = ValueNone
let mutable currItemsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellItemCurrentItemAttribKey.KeyValue then
currShellItemCurrentItemOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
currItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellItemCurrentItemAttribKey.KeyValue then
prevShellItemCurrentItemOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
prevItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdateShellGroupItem (prevOpt, curr, target)
// Update properties
match prevShellItemCurrentItemOpt, currShellItemCurrentItemOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.CurrentItem)
| _, ValueSome newValue ->
target.CurrentItem <- (newValue.Create() :?> Xamarin.Forms.ShellSection)
| ValueSome _, ValueNone ->
target.CurrentItem <- null
| ValueNone, ValueNone -> ()
ViewUpdaters.updateShellItemItems prevItemsOpt currItemsOpt target
(fun _ _ _ -> ())
static member inline ConstructShellItem(?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ShellItem>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.ShellItem -> unit)) =
let attribBuilder = ViewBuilders.BuildShellItem(0,
?currentItem=currentItem,
?items=items,
?flyoutDisplayOptions=flyoutDisplayOptions,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ShellItem>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ShellItem> target))))
ViewElement.Create<Xamarin.Forms.ShellItem>(ViewBuilders.CreateShellItem, (fun prevOpt curr target -> ViewBuilders.UpdateShellItem(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a FlyoutItem in the view
static member inline BuildFlyoutItem(attribCount: int,
?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildShellItem(attribCount, ?currentItem=currentItem, ?items=items, ?flyoutDisplayOptions=flyoutDisplayOptions, ?flyoutIcon=flyoutIcon, ?icon=icon,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?route=route, ?tabIndex=tabIndex, ?title=title,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?created=created)
attribBuilder
static member CreateFlyoutItem () : Xamarin.Forms.FlyoutItem =
new Xamarin.Forms.FlyoutItem()
static member UpdateFlyoutItem (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.FlyoutItem) =
ViewBuilders.UpdateShellItem (prevOpt, curr, target)
static member inline ConstructFlyoutItem(?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.FlyoutItem>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.FlyoutItem -> unit)) =
let attribBuilder = ViewBuilders.BuildFlyoutItem(0,
?currentItem=currentItem,
?items=items,
?flyoutDisplayOptions=flyoutDisplayOptions,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.FlyoutItem>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.FlyoutItem> target))))
ViewElement.Create<Xamarin.Forms.FlyoutItem>(ViewBuilders.CreateFlyoutItem, (fun prevOpt curr target -> ViewBuilders.UpdateFlyoutItem(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a TabBar in the view
static member inline BuildTabBar(attribCount: int,
?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildShellItem(attribCount, ?currentItem=currentItem, ?items=items, ?flyoutDisplayOptions=flyoutDisplayOptions, ?flyoutIcon=flyoutIcon, ?icon=icon,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?route=route, ?tabIndex=tabIndex, ?title=title,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?created=created)
attribBuilder
static member CreateTabBar () : Xamarin.Forms.TabBar =
new Xamarin.Forms.TabBar()
static member UpdateTabBar (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.TabBar) =
ViewBuilders.UpdateShellItem (prevOpt, curr, target)
static member inline ConstructTabBar(?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.TabBar>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.TabBar -> unit)) =
let attribBuilder = ViewBuilders.BuildTabBar(0,
?currentItem=currentItem,
?items=items,
?flyoutDisplayOptions=flyoutDisplayOptions,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.TabBar>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.TabBar> target))))
ViewElement.Create<Xamarin.Forms.TabBar>(ViewBuilders.CreateTabBar, (fun prevOpt curr target -> ViewBuilders.UpdateTabBar(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ShellSection in the view
static member inline BuildShellSection(attribCount: int,
?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribCount = match currentItem with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match items with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildShellGroupItem(attribCount, ?flyoutDisplayOptions=flyoutDisplayOptions, ?flyoutIcon=flyoutIcon, ?icon=icon, ?isEnabled=isEnabled, ?isTabStop=isTabStop,
?route=route, ?tabIndex=tabIndex, ?title=title, ?style=style, ?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu,
?styleId=styleId, ?ref=ref, ?tag=tag, ?appearing=appearing, ?disappearing=disappearing,
?created=created)
match currentItem with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellSectionCurrentItemAttribKey, (v))
match items with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsAttribKey, Array.ofList(v))
attribBuilder
static member CreateShellSection () : Xamarin.Forms.ShellSection =
new Xamarin.Forms.ShellSection()
static member UpdateShellSection (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ShellSection) =
let mutable prevShellSectionCurrentItemOpt = ValueNone
let mutable currShellSectionCurrentItemOpt = ValueNone
let mutable prevItemsOpt = ValueNone
let mutable currItemsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellSectionCurrentItemAttribKey.KeyValue then
currShellSectionCurrentItemOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
currItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellSectionCurrentItemAttribKey.KeyValue then
prevShellSectionCurrentItemOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
prevItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdateShellGroupItem (prevOpt, curr, target)
// Update properties
match prevShellSectionCurrentItemOpt, currShellSectionCurrentItemOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.CurrentItem)
| _, ValueSome newValue ->
target.CurrentItem <- (newValue.Create() :?> Xamarin.Forms.ShellContent)
| ValueSome _, ValueNone ->
target.CurrentItem <- null
| ValueNone, ValueNone -> ()
ViewUpdaters.updateShellSectionItems prevItemsOpt currItemsOpt target
(fun _ _ _ -> ())
static member inline ConstructShellSection(?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ShellSection>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.ShellSection -> unit)) =
let attribBuilder = ViewBuilders.BuildShellSection(0,
?currentItem=currentItem,
?items=items,
?flyoutDisplayOptions=flyoutDisplayOptions,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ShellSection>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ShellSection> target))))
ViewElement.Create<Xamarin.Forms.ShellSection>(ViewBuilders.CreateShellSection, (fun prevOpt curr target -> ViewBuilders.UpdateShellSection(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Tab in the view
static member inline BuildTab(attribCount: int,
?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildShellSection(attribCount, ?currentItem=currentItem, ?items=items, ?flyoutDisplayOptions=flyoutDisplayOptions, ?flyoutIcon=flyoutIcon, ?icon=icon,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?route=route, ?tabIndex=tabIndex, ?title=title,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?created=created)
attribBuilder
static member CreateTab () : Xamarin.Forms.Tab =
new Xamarin.Forms.Tab()
static member UpdateTab (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Tab) =
ViewBuilders.UpdateShellSection (prevOpt, curr, target)
static member inline ConstructTab(?currentItem: ViewElement,
?items: ViewElement list,
?flyoutDisplayOptions: Xamarin.Forms.FlyoutDisplayOptions,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isEnabled: bool,
?isTabStop: bool,
?route: string,
?tabIndex: int,
?title: string,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Tab>,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?created: (Xamarin.Forms.Tab -> unit)) =
let attribBuilder = ViewBuilders.BuildTab(0,
?currentItem=currentItem,
?items=items,
?flyoutDisplayOptions=flyoutDisplayOptions,
?flyoutIcon=flyoutIcon,
?icon=icon,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?route=route,
?tabIndex=tabIndex,
?title=title,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Tab>) -> Some ref.Unbox),
?tag=tag,
?appearing=appearing,
?disappearing=disappearing,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Tab> target))))
ViewElement.Create<Xamarin.Forms.Tab>(ViewBuilders.CreateTab, (fun prevOpt curr target -> ViewBuilders.UpdateTab(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a VisualElement in the view
static member inline BuildVisualElement(attribCount: int,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match anchorX with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match anchorY with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match backgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match behaviors with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flowDirection with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match height with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match inputTransparent with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isTabStop with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isVisible with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match minimumHeight with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match minimumWidth with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match opacity with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match resources with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match rotation with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match rotationX with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match rotationY with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match scale with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match scaleX with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match scaleY with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match styles with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match styleSheets with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match tabIndex with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match translationX with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match translationY with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match visual with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match width with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match focused with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match unfocused with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildNavigableElement(attribCount, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?created=created)
match anchorX with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AnchorXAttribKey, (v))
match anchorY with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AnchorYAttribKey, (v))
match backgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BackgroundColorAttribKey, (v))
match behaviors with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BehaviorsAttribKey, Array.ofList(v))
match flowDirection with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlowDirectionAttribKey, (v))
match height with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HeightRequestAttribKey, (v))
match inputTransparent with None -> () | Some v -> attribBuilder.Add(ViewAttributes.InputTransparentAttribKey, (v))
match isEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsEnabledAttribKey, (v))
match isTabStop with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsTabStopAttribKey, (v))
match isVisible with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsVisibleAttribKey, (v))
match minimumHeight with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MinimumHeightRequestAttribKey, (v))
match minimumWidth with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MinimumWidthRequestAttribKey, (v))
match opacity with None -> () | Some v -> attribBuilder.Add(ViewAttributes.OpacityAttribKey, (v))
match resources with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ResourcesAttribKey, Array.ofList(v))
match rotation with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RotationAttribKey, (v))
match rotationX with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RotationXAttribKey, (v))
match rotationY with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RotationYAttribKey, (v))
match scale with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ScaleAttribKey, (v))
match scaleX with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ScaleXAttribKey, (v))
match scaleY with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ScaleYAttribKey, (v))
match styles with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StylesAttribKey, Array.ofList(v))
match styleSheets with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StyleSheetsAttribKey, Array.ofList(v))
match tabIndex with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TabIndexAttribKey, (v))
match translationX with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TranslationXAttribKey, (v))
match translationY with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TranslationYAttribKey, (v))
match visual with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VisualAttribKey, (v))
match width with None -> () | Some v -> attribBuilder.Add(ViewAttributes.WidthRequestAttribKey, (v))
match focused with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VisualElementFocusedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.FocusEventArgs>(fun _sender _args -> f _args))(v))
match unfocused with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VisualElementUnfocusedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.FocusEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member UpdateVisualElement (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.VisualElement) =
let mutable prevVisualElementFocusedOpt = ValueNone
let mutable currVisualElementFocusedOpt = ValueNone
let mutable prevVisualElementUnfocusedOpt = ValueNone
let mutable currVisualElementUnfocusedOpt = ValueNone
let mutable prevAnchorXOpt = ValueNone
let mutable currAnchorXOpt = ValueNone
let mutable prevAnchorYOpt = ValueNone
let mutable currAnchorYOpt = ValueNone
let mutable prevBackgroundColorOpt = ValueNone
let mutable currBackgroundColorOpt = ValueNone
let mutable prevBehaviorsOpt = ValueNone
let mutable currBehaviorsOpt = ValueNone
let mutable prevFlowDirectionOpt = ValueNone
let mutable currFlowDirectionOpt = ValueNone
let mutable prevHeightRequestOpt = ValueNone
let mutable currHeightRequestOpt = ValueNone
let mutable prevInputTransparentOpt = ValueNone
let mutable currInputTransparentOpt = ValueNone
let mutable prevIsEnabledOpt = ValueNone
let mutable currIsEnabledOpt = ValueNone
let mutable prevIsTabStopOpt = ValueNone
let mutable currIsTabStopOpt = ValueNone
let mutable prevIsVisibleOpt = ValueNone
let mutable currIsVisibleOpt = ValueNone
let mutable prevMinimumHeightRequestOpt = ValueNone
let mutable currMinimumHeightRequestOpt = ValueNone
let mutable prevMinimumWidthRequestOpt = ValueNone
let mutable currMinimumWidthRequestOpt = ValueNone
let mutable prevOpacityOpt = ValueNone
let mutable currOpacityOpt = ValueNone
let mutable prevResourcesOpt = ValueNone
let mutable currResourcesOpt = ValueNone
let mutable prevRotationOpt = ValueNone
let mutable currRotationOpt = ValueNone
let mutable prevRotationXOpt = ValueNone
let mutable currRotationXOpt = ValueNone
let mutable prevRotationYOpt = ValueNone
let mutable currRotationYOpt = ValueNone
let mutable prevScaleOpt = ValueNone
let mutable currScaleOpt = ValueNone
let mutable prevScaleXOpt = ValueNone
let mutable currScaleXOpt = ValueNone
let mutable prevScaleYOpt = ValueNone
let mutable currScaleYOpt = ValueNone
let mutable prevStylesOpt = ValueNone
let mutable currStylesOpt = ValueNone
let mutable prevStyleSheetsOpt = ValueNone
let mutable currStyleSheetsOpt = ValueNone
let mutable prevTabIndexOpt = ValueNone
let mutable currTabIndexOpt = ValueNone
let mutable prevTranslationXOpt = ValueNone
let mutable currTranslationXOpt = ValueNone
let mutable prevTranslationYOpt = ValueNone
let mutable currTranslationYOpt = ValueNone
let mutable prevVisualOpt = ValueNone
let mutable currVisualOpt = ValueNone
let mutable prevWidthRequestOpt = ValueNone
let mutable currWidthRequestOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.VisualElementFocusedAttribKey.KeyValue then
currVisualElementFocusedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.FocusEventArgs>)
if kvp.Key = ViewAttributes.VisualElementUnfocusedAttribKey.KeyValue then
currVisualElementUnfocusedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.FocusEventArgs>)
if kvp.Key = ViewAttributes.AnchorXAttribKey.KeyValue then
currAnchorXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.AnchorYAttribKey.KeyValue then
currAnchorYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.BackgroundColorAttribKey.KeyValue then
currBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BehaviorsAttribKey.KeyValue then
currBehaviorsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.FlowDirectionAttribKey.KeyValue then
currFlowDirectionOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlowDirection)
if kvp.Key = ViewAttributes.HeightRequestAttribKey.KeyValue then
currHeightRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.InputTransparentAttribKey.KeyValue then
currInputTransparentOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
currIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTabStopAttribKey.KeyValue then
currIsTabStopOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsVisibleAttribKey.KeyValue then
currIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.MinimumHeightRequestAttribKey.KeyValue then
currMinimumHeightRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.MinimumWidthRequestAttribKey.KeyValue then
currMinimumWidthRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.OpacityAttribKey.KeyValue then
currOpacityOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ResourcesAttribKey.KeyValue then
currResourcesOpt <- ValueSome (kvp.Value :?> (string * obj) array)
if kvp.Key = ViewAttributes.RotationAttribKey.KeyValue then
currRotationOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.RotationXAttribKey.KeyValue then
currRotationXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.RotationYAttribKey.KeyValue then
currRotationYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleAttribKey.KeyValue then
currScaleOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleXAttribKey.KeyValue then
currScaleXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleYAttribKey.KeyValue then
currScaleYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.StylesAttribKey.KeyValue then
currStylesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style array)
if kvp.Key = ViewAttributes.StyleSheetsAttribKey.KeyValue then
currStyleSheetsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.StyleSheets.StyleSheet array)
if kvp.Key = ViewAttributes.TabIndexAttribKey.KeyValue then
currTabIndexOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TranslationXAttribKey.KeyValue then
currTranslationXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.TranslationYAttribKey.KeyValue then
currTranslationYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.VisualAttribKey.KeyValue then
currVisualOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.IVisual)
if kvp.Key = ViewAttributes.WidthRequestAttribKey.KeyValue then
currWidthRequestOpt <- ValueSome (kvp.Value :?> float)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.VisualElementFocusedAttribKey.KeyValue then
prevVisualElementFocusedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.FocusEventArgs>)
if kvp.Key = ViewAttributes.VisualElementUnfocusedAttribKey.KeyValue then
prevVisualElementUnfocusedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.FocusEventArgs>)
if kvp.Key = ViewAttributes.AnchorXAttribKey.KeyValue then
prevAnchorXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.AnchorYAttribKey.KeyValue then
prevAnchorYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.BackgroundColorAttribKey.KeyValue then
prevBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BehaviorsAttribKey.KeyValue then
prevBehaviorsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.FlowDirectionAttribKey.KeyValue then
prevFlowDirectionOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlowDirection)
if kvp.Key = ViewAttributes.HeightRequestAttribKey.KeyValue then
prevHeightRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.InputTransparentAttribKey.KeyValue then
prevInputTransparentOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsEnabledAttribKey.KeyValue then
prevIsEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTabStopAttribKey.KeyValue then
prevIsTabStopOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsVisibleAttribKey.KeyValue then
prevIsVisibleOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.MinimumHeightRequestAttribKey.KeyValue then
prevMinimumHeightRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.MinimumWidthRequestAttribKey.KeyValue then
prevMinimumWidthRequestOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.OpacityAttribKey.KeyValue then
prevOpacityOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ResourcesAttribKey.KeyValue then
prevResourcesOpt <- ValueSome (kvp.Value :?> (string * obj) array)
if kvp.Key = ViewAttributes.RotationAttribKey.KeyValue then
prevRotationOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.RotationXAttribKey.KeyValue then
prevRotationXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.RotationYAttribKey.KeyValue then
prevRotationYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleAttribKey.KeyValue then
prevScaleOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleXAttribKey.KeyValue then
prevScaleXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ScaleYAttribKey.KeyValue then
prevScaleYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.StylesAttribKey.KeyValue then
prevStylesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Style array)
if kvp.Key = ViewAttributes.StyleSheetsAttribKey.KeyValue then
prevStyleSheetsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.StyleSheets.StyleSheet array)
if kvp.Key = ViewAttributes.TabIndexAttribKey.KeyValue then
prevTabIndexOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TranslationXAttribKey.KeyValue then
prevTranslationXOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.TranslationYAttribKey.KeyValue then
prevTranslationYOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.VisualAttribKey.KeyValue then
prevVisualOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.IVisual)
if kvp.Key = ViewAttributes.WidthRequestAttribKey.KeyValue then
prevWidthRequestOpt <- ValueSome (kvp.Value :?> float)
// Unsubscribe previous event handlers
let shouldUpdateVisualElementFocused = not ((identical prevVisualElementFocusedOpt currVisualElementFocusedOpt))
if shouldUpdateVisualElementFocused then
match prevVisualElementFocusedOpt with
| ValueSome prevValue -> target.Focused.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateVisualElementUnfocused = not ((identical prevVisualElementUnfocusedOpt currVisualElementUnfocusedOpt))
if shouldUpdateVisualElementUnfocused then
match prevVisualElementUnfocusedOpt with
| ValueSome prevValue -> target.Unfocused.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateNavigableElement (prevOpt, curr, target)
// Update properties
match prevAnchorXOpt, currAnchorXOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.AnchorX <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.AnchorXProperty
| ValueNone, ValueNone -> ()
match prevAnchorYOpt, currAnchorYOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.AnchorY <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.AnchorYProperty
| ValueNone, ValueNone -> ()
match prevBackgroundColorOpt, currBackgroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BackgroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.BackgroundColorProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateCollectionGeneric prevBehaviorsOpt currBehaviorsOpt target.Behaviors
(fun (x:ViewElement) -> x.Create() :?> Xamarin.Forms.Behavior)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
match prevFlowDirectionOpt, currFlowDirectionOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlowDirection <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.FlowDirectionProperty
| ValueNone, ValueNone -> ()
match prevHeightRequestOpt, currHeightRequestOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HeightRequest <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.HeightRequestProperty
| ValueNone, ValueNone -> ()
match prevInputTransparentOpt, currInputTransparentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.InputTransparent <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.InputTransparentProperty
| ValueNone, ValueNone -> ()
match prevIsEnabledOpt, currIsEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.IsEnabledProperty
| ValueNone, ValueNone -> ()
match prevIsTabStopOpt, currIsTabStopOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsTabStop <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.IsTabStopProperty
| ValueNone, ValueNone -> ()
match prevIsVisibleOpt, currIsVisibleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsVisible <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.IsVisibleProperty
| ValueNone, ValueNone -> ()
match prevMinimumHeightRequestOpt, currMinimumHeightRequestOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MinimumHeightRequest <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.MinimumHeightRequestProperty
| ValueNone, ValueNone -> ()
match prevMinimumWidthRequestOpt, currMinimumWidthRequestOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MinimumWidthRequest <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.MinimumWidthRequestProperty
| ValueNone, ValueNone -> ()
match prevOpacityOpt, currOpacityOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Opacity <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.OpacityProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateResources prevResourcesOpt currResourcesOpt target
match prevRotationOpt, currRotationOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Rotation <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.RotationProperty
| ValueNone, ValueNone -> ()
match prevRotationXOpt, currRotationXOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.RotationX <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.RotationXProperty
| ValueNone, ValueNone -> ()
match prevRotationYOpt, currRotationYOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.RotationY <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.RotationYProperty
| ValueNone, ValueNone -> ()
match prevScaleOpt, currScaleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Scale <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.ScaleProperty
| ValueNone, ValueNone -> ()
match prevScaleXOpt, currScaleXOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ScaleX <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.ScaleXProperty
| ValueNone, ValueNone -> ()
match prevScaleYOpt, currScaleYOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ScaleY <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.ScaleYProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateStyles prevStylesOpt currStylesOpt target
ViewUpdaters.updateStyleSheets prevStyleSheetsOpt currStyleSheetsOpt target
match prevTabIndexOpt, currTabIndexOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TabIndex <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.TabIndexProperty
| ValueNone, ValueNone -> ()
match prevTranslationXOpt, currTranslationXOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TranslationX <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.TranslationXProperty
| ValueNone, ValueNone -> ()
match prevTranslationYOpt, currTranslationYOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TranslationY <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.TranslationYProperty
| ValueNone, ValueNone -> ()
match prevVisualOpt, currVisualOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Visual <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.VisualProperty
| ValueNone, ValueNone -> ()
match prevWidthRequestOpt, currWidthRequestOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.WidthRequest <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.VisualElement.WidthRequestProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateVisualElementFocused then
match currVisualElementFocusedOpt with
| ValueSome currValue -> target.Focused.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateVisualElementUnfocused then
match currVisualElementUnfocusedOpt with
| ValueSome currValue -> target.Unfocused.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a Page in the view
static member inline BuildPage(attribCount: int,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match backgroundImage with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match icon with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isBusy with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match padding with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match title with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match toolbarItems with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match useSafeArea with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match hasNavigationBar with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match appearing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match disappearing with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildVisualElement(attribCount, ?anchorX=anchorX, ?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection,
?height=height, ?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible,
?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation,
?rotationX=rotationX, ?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY,
?styles=styles, ?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY,
?visual=visual, ?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match backgroundImage with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BackgroundImageSourceAttribKey, (v))
match icon with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IconImageSourceAttribKey, (v))
match isBusy with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsBusyAttribKey, (v))
match padding with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PaddingAttribKey, (v))
match title with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TitleAttribKey, (v))
match toolbarItems with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ToolbarItemsAttribKey, Array.ofList(v))
match useSafeArea with None -> () | Some v -> attribBuilder.Add(ViewAttributes.UseSafeAreaAttribKey, (v))
match hasNavigationBar with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HasNavigationBarAttribKey, (v))
match appearing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AppearingAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
match disappearing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.DisappearingAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
attribBuilder
static member UpdatePage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Page) =
let mutable prevAppearingOpt = ValueNone
let mutable currAppearingOpt = ValueNone
let mutable prevDisappearingOpt = ValueNone
let mutable currDisappearingOpt = ValueNone
let mutable prevBackgroundImageSourceOpt = ValueNone
let mutable currBackgroundImageSourceOpt = ValueNone
let mutable prevIconImageSourceOpt = ValueNone
let mutable currIconImageSourceOpt = ValueNone
let mutable prevIsBusyOpt = ValueNone
let mutable currIsBusyOpt = ValueNone
let mutable prevPaddingOpt = ValueNone
let mutable currPaddingOpt = ValueNone
let mutable prevTitleOpt = ValueNone
let mutable currTitleOpt = ValueNone
let mutable prevToolbarItemsOpt = ValueNone
let mutable currToolbarItemsOpt = ValueNone
let mutable prevUseSafeAreaOpt = ValueNone
let mutable currUseSafeAreaOpt = ValueNone
let mutable prevHasNavigationBarOpt = ValueNone
let mutable currHasNavigationBarOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.AppearingAttribKey.KeyValue then
currAppearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.DisappearingAttribKey.KeyValue then
currDisappearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.BackgroundImageSourceAttribKey.KeyValue then
currBackgroundImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IconImageSourceAttribKey.KeyValue then
currIconImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsBusyAttribKey.KeyValue then
currIsBusyOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
currPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.TitleAttribKey.KeyValue then
currTitleOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.ToolbarItemsAttribKey.KeyValue then
currToolbarItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.UseSafeAreaAttribKey.KeyValue then
currUseSafeAreaOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.HasNavigationBarAttribKey.KeyValue then
currHasNavigationBarOpt <- ValueSome (kvp.Value :?> bool)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.AppearingAttribKey.KeyValue then
prevAppearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.DisappearingAttribKey.KeyValue then
prevDisappearingOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.BackgroundImageSourceAttribKey.KeyValue then
prevBackgroundImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IconImageSourceAttribKey.KeyValue then
prevIconImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.IsBusyAttribKey.KeyValue then
prevIsBusyOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
prevPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.TitleAttribKey.KeyValue then
prevTitleOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.ToolbarItemsAttribKey.KeyValue then
prevToolbarItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.UseSafeAreaAttribKey.KeyValue then
prevUseSafeAreaOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.HasNavigationBarAttribKey.KeyValue then
prevHasNavigationBarOpt <- ValueSome (kvp.Value :?> bool)
// Unsubscribe previous event handlers
let shouldUpdateAppearing = not ((identical prevAppearingOpt currAppearingOpt))
if shouldUpdateAppearing then
match prevAppearingOpt with
| ValueSome prevValue -> target.Appearing.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateDisappearing = not ((identical prevDisappearingOpt currDisappearingOpt))
if shouldUpdateDisappearing then
match prevDisappearingOpt with
| ValueSome prevValue -> target.Disappearing.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateVisualElement (prevOpt, curr, target)
// Update properties
match prevBackgroundImageSourceOpt, currBackgroundImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BackgroundImageSource <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Page.BackgroundImageSourceProperty
| ValueNone, ValueNone -> ()
match prevIconImageSourceOpt, currIconImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IconImageSource <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Page.IconImageSourceProperty
| ValueNone, ValueNone -> ()
match prevIsBusyOpt, currIsBusyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsBusy <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Page.IsBusyProperty
| ValueNone, ValueNone -> ()
match prevPaddingOpt, currPaddingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Padding <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Page.PaddingProperty
| ValueNone, ValueNone -> ()
match prevTitleOpt, currTitleOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Title <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Page.TitleProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updatePageToolbarItems prevToolbarItemsOpt currToolbarItemsOpt target
(fun _ _ _ -> ())
ViewUpdaters.updatePageUseSafeArea prevUseSafeAreaOpt currUseSafeAreaOpt target
ViewUpdaters.updateNavigationPageHasNavigationBar prevHasNavigationBarOpt currHasNavigationBarOpt target
// Subscribe new event handlers
if shouldUpdateAppearing then
match currAppearingOpt with
| ValueSome currValue -> target.Appearing.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateDisappearing then
match currDisappearingOpt with
| ValueSome currValue -> target.Disappearing.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a MasterDetailPage in the view
static member inline BuildMasterDetailPage(attribCount: int,
?detail: ViewElement,
?isGestureEnabled: bool,
?isPresented: bool,
?master: ViewElement,
?masterBehavior: Xamarin.Forms.MasterBehavior,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?backButtonPressed: Xamarin.Forms.BackButtonPressedEventArgs -> unit,
?isPresentedChanged: bool -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match detail with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isGestureEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isPresented with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match master with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match masterBehavior with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match backButtonPressed with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isPresentedChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildPage(attribCount, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding, ?title=title,
?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused, ?created=created)
match detail with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MasterDetailPageDetailAttribKey, (v))
match isGestureEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsGestureEnabledAttribKey, (v))
match isPresented with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsPresentedAttribKey, (v))
match master with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MasterAttribKey, (v))
match masterBehavior with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MasterBehaviorAttribKey, (v))
match backButtonPressed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BackButtonPressedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.BackButtonPressedEventArgs>(fun _sender _args -> f _args))(v))
match isPresentedChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsPresentedChangedAttribKey, ViewConverters.makeMasterDetailPageIsPresentedChangedEventHandler(v))
attribBuilder
static member CreateMasterDetailPage () : Xamarin.Forms.MasterDetailPage =
new Xamarin.Forms.MasterDetailPage()
static member UpdateMasterDetailPage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.MasterDetailPage) =
let mutable prevBackButtonPressedOpt = ValueNone
let mutable currBackButtonPressedOpt = ValueNone
let mutable prevIsPresentedChangedOpt = ValueNone
let mutable currIsPresentedChangedOpt = ValueNone
let mutable prevMasterDetailPageDetailOpt = ValueNone
let mutable currMasterDetailPageDetailOpt = ValueNone
let mutable prevIsGestureEnabledOpt = ValueNone
let mutable currIsGestureEnabledOpt = ValueNone
let mutable prevIsPresentedOpt = ValueNone
let mutable currIsPresentedOpt = ValueNone
let mutable prevMasterOpt = ValueNone
let mutable currMasterOpt = ValueNone
let mutable prevMasterBehaviorOpt = ValueNone
let mutable currMasterBehaviorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.BackButtonPressedAttribKey.KeyValue then
currBackButtonPressedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.BackButtonPressedEventArgs>)
if kvp.Key = ViewAttributes.IsPresentedChangedAttribKey.KeyValue then
currIsPresentedChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.MasterDetailPageDetailAttribKey.KeyValue then
currMasterDetailPageDetailOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.IsGestureEnabledAttribKey.KeyValue then
currIsGestureEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsPresentedAttribKey.KeyValue then
currIsPresentedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.MasterAttribKey.KeyValue then
currMasterOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.MasterBehaviorAttribKey.KeyValue then
currMasterBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.MasterBehavior)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.BackButtonPressedAttribKey.KeyValue then
prevBackButtonPressedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.BackButtonPressedEventArgs>)
if kvp.Key = ViewAttributes.IsPresentedChangedAttribKey.KeyValue then
prevIsPresentedChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.MasterDetailPageDetailAttribKey.KeyValue then
prevMasterDetailPageDetailOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.IsGestureEnabledAttribKey.KeyValue then
prevIsGestureEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsPresentedAttribKey.KeyValue then
prevIsPresentedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.MasterAttribKey.KeyValue then
prevMasterOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.MasterBehaviorAttribKey.KeyValue then
prevMasterBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.MasterBehavior)
// Unsubscribe previous event handlers
let shouldUpdateBackButtonPressed = not ((identical prevBackButtonPressedOpt currBackButtonPressedOpt))
if shouldUpdateBackButtonPressed then
match prevBackButtonPressedOpt with
| ValueSome prevValue -> target.BackButtonPressed.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateIsPresentedChanged = not ((identical prevIsPresentedChangedOpt currIsPresentedChangedOpt) && (identical prevIsPresentedOpt currIsPresentedOpt))
if shouldUpdateIsPresentedChanged then
match prevIsPresentedChangedOpt with
| ValueSome prevValue -> target.IsPresentedChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdatePage (prevOpt, curr, target)
// Update properties
match prevMasterDetailPageDetailOpt, currMasterDetailPageDetailOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.Detail)
| _, ValueSome newValue ->
target.Detail <- (newValue.Create() :?> Xamarin.Forms.Page)
| ValueSome _, ValueNone ->
target.Detail <- null
| ValueNone, ValueNone -> ()
match prevIsGestureEnabledOpt, currIsGestureEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsGestureEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MasterDetailPage.IsGestureEnabledProperty
| ValueNone, ValueNone -> ()
match prevIsPresentedOpt, currIsPresentedOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsPresented <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MasterDetailPage.IsPresentedProperty
| ValueNone, ValueNone -> ()
match prevMasterOpt, currMasterOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.Master)
| _, ValueSome newValue ->
target.Master <- (newValue.Create() :?> Xamarin.Forms.Page)
| ValueSome _, ValueNone ->
target.Master <- null
| ValueNone, ValueNone -> ()
match prevMasterBehaviorOpt, currMasterBehaviorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MasterBehavior <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.MasterDetailPage.MasterBehaviorProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateBackButtonPressed then
match currBackButtonPressedOpt with
| ValueSome currValue -> target.BackButtonPressed.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateIsPresentedChanged then
match currIsPresentedChangedOpt with
| ValueSome currValue -> target.IsPresentedChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructMasterDetailPage(?detail: ViewElement,
?isGestureEnabled: bool,
?isPresented: bool,
?master: ViewElement,
?masterBehavior: Xamarin.Forms.MasterBehavior,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.MasterDetailPage>,
?tag: obj,
?backButtonPressed: Xamarin.Forms.BackButtonPressedEventArgs -> unit,
?isPresentedChanged: bool -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.MasterDetailPage -> unit)) =
let attribBuilder = ViewBuilders.BuildMasterDetailPage(0,
?detail=detail,
?isGestureEnabled=isGestureEnabled,
?isPresented=isPresented,
?master=master,
?masterBehavior=masterBehavior,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.MasterDetailPage>) -> Some ref.Unbox),
?tag=tag,
?backButtonPressed=backButtonPressed,
?isPresentedChanged=isPresentedChanged,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.MasterDetailPage> target))))
ViewElement.Create<Xamarin.Forms.MasterDetailPage>(ViewBuilders.CreateMasterDetailPage, (fun prevOpt curr target -> ViewBuilders.UpdateMasterDetailPage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a MultiPageOfT in the view
static member inline BuildMultiPageOfT(attribCount: int,
?children: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match children with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildPage(attribCount, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding, ?title=title,
?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused, ?created=created)
match children with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ChildrenAttribKey, Array.ofList(v))
attribBuilder
static member UpdateMultiPageOfT (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.MultiPage<'T>) =
let mutable prevChildrenOpt = ValueNone
let mutable currChildrenOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ChildrenAttribKey.KeyValue then
currChildrenOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ChildrenAttribKey.KeyValue then
prevChildrenOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Update inherited members
ViewBuilders.UpdatePage (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateCollectionGeneric prevChildrenOpt currChildrenOpt target.Children
(fun (x:ViewElement) -> x.Create() :?> 'T)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
/// Builds the attributes for a CarouselPage in the view
static member inline BuildCarouselPage(attribCount: int,
?currentPage: int,
?children: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?currentPageChanged: int option -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match currentPage with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match currentPageChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildMultiPageOfT(attribCount, ?children=children, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding,
?title=title, ?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused,
?created=created)
match currentPage with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CurrentPageAttribKey, (v))
match currentPageChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CurrentPageChangedAttribKey, ViewConverters.makeCurrentPageChanged<Xamarin.Forms.ContentPage>(v))
attribBuilder
static member CreateCarouselPage () : Xamarin.Forms.CarouselPage =
new Xamarin.Forms.CarouselPage()
static member UpdateCarouselPage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.CarouselPage) =
let mutable prevCurrentPageChangedOpt = ValueNone
let mutable currCurrentPageChangedOpt = ValueNone
let mutable prevCurrentPageOpt = ValueNone
let mutable currCurrentPageOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentPageChangedAttribKey.KeyValue then
currCurrentPageChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.CurrentPageAttribKey.KeyValue then
currCurrentPageOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentPageChangedAttribKey.KeyValue then
prevCurrentPageChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.CurrentPageAttribKey.KeyValue then
prevCurrentPageOpt <- ValueSome (kvp.Value :?> int)
// Unsubscribe previous event handlers
let shouldUpdateCurrentPageChanged = not ((identical prevCurrentPageChangedOpt currCurrentPageChangedOpt) && (identical prevCurrentPageOpt currCurrentPageOpt))
if shouldUpdateCurrentPageChanged then
match prevCurrentPageChangedOpt with
| ValueSome prevValue -> target.CurrentPageChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateMultiPageOfT (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateMultiPageOfTCurrentPage<Xamarin.Forms.ContentPage> prevCurrentPageOpt currCurrentPageOpt target
// Subscribe new event handlers
if shouldUpdateCurrentPageChanged then
match currCurrentPageChangedOpt with
| ValueSome currValue -> target.CurrentPageChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructCarouselPage(?currentPage: int,
?children: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.CarouselPage>,
?tag: obj,
?currentPageChanged: int option -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.CarouselPage -> unit)) =
let attribBuilder = ViewBuilders.BuildCarouselPage(0,
?currentPage=currentPage,
?children=children,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.CarouselPage>) -> Some ref.Unbox),
?tag=tag,
?currentPageChanged=currentPageChanged,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.CarouselPage> target))))
ViewElement.Create<Xamarin.Forms.CarouselPage>(ViewBuilders.CreateCarouselPage, (fun prevOpt curr target -> ViewBuilders.UpdateCarouselPage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a TabbedPage in the view
static member inline BuildTabbedPage(attribCount: int,
?barBackgroundColor: Xamarin.Forms.Color,
?barTextColor: Xamarin.Forms.Color,
?currentPage: int,
?selectedTabColor: Xamarin.Forms.Color,
?unselectedTabColor: Xamarin.Forms.Color,
?children: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?currentPageChanged: int option -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match barBackgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match barTextColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match currentPage with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match selectedTabColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match unselectedTabColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match currentPageChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildMultiPageOfT(attribCount, ?children=children, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding,
?title=title, ?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused,
?created=created)
match barBackgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BarBackgroundColorAttribKey, (v))
match barTextColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BarTextColorAttribKey, (v))
match currentPage with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CurrentPageAttribKey, (v))
match selectedTabColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectedTabColorAttribKey, (v))
match unselectedTabColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.UnselectedTabColorAttribKey, (v))
match currentPageChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CurrentPageChangedAttribKey, ViewConverters.makeCurrentPageChanged<Xamarin.Forms.Page>(v))
attribBuilder
static member CreateTabbedPage () : Xamarin.Forms.TabbedPage =
new Xamarin.Forms.TabbedPage()
static member UpdateTabbedPage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.TabbedPage) =
let mutable prevCurrentPageChangedOpt = ValueNone
let mutable currCurrentPageChangedOpt = ValueNone
let mutable prevBarBackgroundColorOpt = ValueNone
let mutable currBarBackgroundColorOpt = ValueNone
let mutable prevBarTextColorOpt = ValueNone
let mutable currBarTextColorOpt = ValueNone
let mutable prevCurrentPageOpt = ValueNone
let mutable currCurrentPageOpt = ValueNone
let mutable prevSelectedTabColorOpt = ValueNone
let mutable currSelectedTabColorOpt = ValueNone
let mutable prevUnselectedTabColorOpt = ValueNone
let mutable currUnselectedTabColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentPageChangedAttribKey.KeyValue then
currCurrentPageChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.BarBackgroundColorAttribKey.KeyValue then
currBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BarTextColorAttribKey.KeyValue then
currBarTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.CurrentPageAttribKey.KeyValue then
currCurrentPageOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.SelectedTabColorAttribKey.KeyValue then
currSelectedTabColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.UnselectedTabColorAttribKey.KeyValue then
currUnselectedTabColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentPageChangedAttribKey.KeyValue then
prevCurrentPageChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.BarBackgroundColorAttribKey.KeyValue then
prevBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BarTextColorAttribKey.KeyValue then
prevBarTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.CurrentPageAttribKey.KeyValue then
prevCurrentPageOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.SelectedTabColorAttribKey.KeyValue then
prevSelectedTabColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.UnselectedTabColorAttribKey.KeyValue then
prevUnselectedTabColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Unsubscribe previous event handlers
let shouldUpdateCurrentPageChanged = not ((identical prevCurrentPageChangedOpt currCurrentPageChangedOpt) && (identical prevCurrentPageOpt currCurrentPageOpt))
if shouldUpdateCurrentPageChanged then
match prevCurrentPageChangedOpt with
| ValueSome prevValue -> target.CurrentPageChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateMultiPageOfT (prevOpt, curr, target)
// Update properties
match prevBarBackgroundColorOpt, currBarBackgroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BarBackgroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TabbedPage.BarBackgroundColorProperty
| ValueNone, ValueNone -> ()
match prevBarTextColorOpt, currBarTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BarTextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TabbedPage.BarTextColorProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateMultiPageOfTCurrentPage<Xamarin.Forms.Page> prevCurrentPageOpt currCurrentPageOpt target
match prevSelectedTabColorOpt, currSelectedTabColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.SelectedTabColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TabbedPage.SelectedTabColorProperty
| ValueNone, ValueNone -> ()
match prevUnselectedTabColorOpt, currUnselectedTabColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.UnselectedTabColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.TabbedPage.UnselectedTabColorProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCurrentPageChanged then
match currCurrentPageChangedOpt with
| ValueSome currValue -> target.CurrentPageChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructTabbedPage(?barBackgroundColor: Xamarin.Forms.Color,
?barTextColor: Xamarin.Forms.Color,
?currentPage: int,
?selectedTabColor: Xamarin.Forms.Color,
?unselectedTabColor: Xamarin.Forms.Color,
?children: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.TabbedPage>,
?tag: obj,
?currentPageChanged: int option -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.TabbedPage -> unit)) =
let attribBuilder = ViewBuilders.BuildTabbedPage(0,
?barBackgroundColor=barBackgroundColor,
?barTextColor=barTextColor,
?currentPage=currentPage,
?selectedTabColor=selectedTabColor,
?unselectedTabColor=unselectedTabColor,
?children=children,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.TabbedPage>) -> Some ref.Unbox),
?tag=tag,
?currentPageChanged=currentPageChanged,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.TabbedPage> target))))
ViewElement.Create<Xamarin.Forms.TabbedPage>(ViewBuilders.CreateTabbedPage, (fun prevOpt curr target -> ViewBuilders.UpdateTabbedPage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a NavigationPage in the view
static member inline BuildNavigationPage(attribCount: int,
?barBackgroundColor: Xamarin.Forms.Color,
?barTextColor: Xamarin.Forms.Color,
?pages: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?popped: Xamarin.Forms.NavigationEventArgs -> unit,
?poppedToRoot: Xamarin.Forms.NavigationEventArgs -> unit,
?pushed: Xamarin.Forms.NavigationEventArgs -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match barBackgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match barTextColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match pages with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match popped with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match poppedToRoot with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match pushed with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildPage(attribCount, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding, ?title=title,
?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused, ?created=created)
match barBackgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BarBackgroundColorAttribKey, (v))
match barTextColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BarTextColorAttribKey, (v))
match pages with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PagesAttribKey, Array.ofList(v))
match popped with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PoppedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.NavigationEventArgs>(fun _sender _args -> f _args))(v))
match poppedToRoot with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PoppedToRootAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.NavigationEventArgs>(fun _sender _args -> f _args))(v))
match pushed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PushedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.NavigationEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateNavigationPage () : Xamarin.Forms.NavigationPage =
new Xamarin.Forms.NavigationPage()
static member UpdateNavigationPage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.NavigationPage) =
let mutable prevPoppedOpt = ValueNone
let mutable currPoppedOpt = ValueNone
let mutable prevPoppedToRootOpt = ValueNone
let mutable currPoppedToRootOpt = ValueNone
let mutable prevPushedOpt = ValueNone
let mutable currPushedOpt = ValueNone
let mutable prevBarBackgroundColorOpt = ValueNone
let mutable currBarBackgroundColorOpt = ValueNone
let mutable prevBarTextColorOpt = ValueNone
let mutable currBarTextColorOpt = ValueNone
let mutable prevPagesOpt = ValueNone
let mutable currPagesOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.PoppedAttribKey.KeyValue then
currPoppedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.PoppedToRootAttribKey.KeyValue then
currPoppedToRootOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.PushedAttribKey.KeyValue then
currPushedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.BarBackgroundColorAttribKey.KeyValue then
currBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BarTextColorAttribKey.KeyValue then
currBarTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.PagesAttribKey.KeyValue then
currPagesOpt <- ValueSome (kvp.Value :?> ViewElement array)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.PoppedAttribKey.KeyValue then
prevPoppedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.PoppedToRootAttribKey.KeyValue then
prevPoppedToRootOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.PushedAttribKey.KeyValue then
prevPushedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.NavigationEventArgs>)
if kvp.Key = ViewAttributes.BarBackgroundColorAttribKey.KeyValue then
prevBarBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BarTextColorAttribKey.KeyValue then
prevBarTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.PagesAttribKey.KeyValue then
prevPagesOpt <- ValueSome (kvp.Value :?> ViewElement array)
// Unsubscribe previous event handlers
let shouldUpdatePopped = not ((identical prevPoppedOpt currPoppedOpt))
if shouldUpdatePopped then
match prevPoppedOpt with
| ValueSome prevValue -> target.Popped.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdatePoppedToRoot = not ((identical prevPoppedToRootOpt currPoppedToRootOpt))
if shouldUpdatePoppedToRoot then
match prevPoppedToRootOpt with
| ValueSome prevValue -> target.PoppedToRoot.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdatePushed = not ((identical prevPushedOpt currPushedOpt))
if shouldUpdatePushed then
match prevPushedOpt with
| ValueSome prevValue -> target.Pushed.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdatePage (prevOpt, curr, target)
// Update properties
match prevBarBackgroundColorOpt, currBarBackgroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BarBackgroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.NavigationPage.BarBackgroundColorProperty
| ValueNone, ValueNone -> ()
match prevBarTextColorOpt, currBarTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BarTextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.NavigationPage.BarTextColorProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateNavigationPages prevPagesOpt currPagesOpt target
(fun prevChildOpt newChild targetChild ->
// Adjust the attached properties
let prevBackButtonTitleOpt = match prevChildOpt with ValueNone -> ValueNone | ValueSome prevChild -> prevChild.TryGetAttributeKeyed<string>(ViewAttributes.BackButtonTitleAttribKey)
let currBackButtonTitleOpt = newChild.TryGetAttributeKeyed<string>(ViewAttributes.BackButtonTitleAttribKey)
match prevBackButtonTitleOpt, currBackButtonTitleOpt with
| ValueSome prevChildValue, ValueSome currChildValue when prevChildValue = currChildValue -> ()
| _, ValueSome currChildValue -> Xamarin.Forms.NavigationPage.SetBackButtonTitle(targetChild, currChildValue)
| ValueSome _, ValueNone -> Xamarin.Forms.NavigationPage.SetBackButtonTitle(targetChild, null)
| _ -> ()
let prevHasBackButtonOpt = match prevChildOpt with ValueNone -> ValueNone | ValueSome prevChild -> prevChild.TryGetAttributeKeyed<bool>(ViewAttributes.HasBackButtonAttribKey)
let currHasBackButtonOpt = newChild.TryGetAttributeKeyed<bool>(ViewAttributes.HasBackButtonAttribKey)
match prevHasBackButtonOpt, currHasBackButtonOpt with
| ValueSome prevChildValue, ValueSome currChildValue when prevChildValue = currChildValue -> ()
| _, ValueSome currChildValue -> Xamarin.Forms.NavigationPage.SetHasBackButton(targetChild, currChildValue)
| ValueSome _, ValueNone -> Xamarin.Forms.NavigationPage.SetHasBackButton(targetChild, true)
| _ -> ()
let prevTitleIconImageSourceOpt = match prevChildOpt with ValueNone -> ValueNone | ValueSome prevChild -> prevChild.TryGetAttributeKeyed<Xamarin.Forms.ImageSource>(ViewAttributes.TitleIconImageSourceAttribKey)
let currTitleIconImageSourceOpt = newChild.TryGetAttributeKeyed<Xamarin.Forms.ImageSource>(ViewAttributes.TitleIconImageSourceAttribKey)
match prevTitleIconImageSourceOpt, currTitleIconImageSourceOpt with
| ValueSome prevChildValue, ValueSome currChildValue when prevChildValue = currChildValue -> ()
| _, ValueSome currChildValue -> Xamarin.Forms.NavigationPage.SetTitleIconImageSource(targetChild, currChildValue)
| ValueSome _, ValueNone -> Xamarin.Forms.NavigationPage.SetTitleIconImageSource(targetChild, null)
| _ -> ()
let prevTitleViewOpt = match prevChildOpt with ValueNone -> ValueNone | ValueSome prevChild -> prevChild.TryGetAttributeKeyed<ViewElement>(ViewAttributes.TitleViewAttribKey)
let currTitleViewOpt = newChild.TryGetAttributeKeyed<ViewElement>(ViewAttributes.TitleViewAttribKey)
match prevTitleViewOpt, currTitleViewOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, (Xamarin.Forms.NavigationPage.GetTitleView(targetChild)))
| _, ValueSome newValue ->
Xamarin.Forms.NavigationPage.SetTitleView(targetChild, (newValue.Create() :?> Xamarin.Forms.View))
| ValueSome _, ValueNone ->
Xamarin.Forms.NavigationPage.SetTitleView(targetChild, null)
| ValueNone, ValueNone -> ()
)
// Subscribe new event handlers
if shouldUpdatePopped then
match currPoppedOpt with
| ValueSome currValue -> target.Popped.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdatePoppedToRoot then
match currPoppedToRootOpt with
| ValueSome currValue -> target.PoppedToRoot.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdatePushed then
match currPushedOpt with
| ValueSome currValue -> target.Pushed.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructNavigationPage(?barBackgroundColor: Xamarin.Forms.Color,
?barTextColor: Xamarin.Forms.Color,
?pages: ViewElement list,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.NavigationPage>,
?tag: obj,
?popped: Xamarin.Forms.NavigationEventArgs -> unit,
?poppedToRoot: Xamarin.Forms.NavigationEventArgs -> unit,
?pushed: Xamarin.Forms.NavigationEventArgs -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.NavigationPage -> unit)) =
let attribBuilder = ViewBuilders.BuildNavigationPage(0,
?barBackgroundColor=barBackgroundColor,
?barTextColor=barTextColor,
?pages=pages,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.NavigationPage>) -> Some ref.Unbox),
?tag=tag,
?popped=popped,
?poppedToRoot=poppedToRoot,
?pushed=pushed,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.NavigationPage> target))))
ViewElement.Create<Xamarin.Forms.NavigationPage>(ViewBuilders.CreateNavigationPage, (fun prevOpt curr target -> ViewBuilders.UpdateNavigationPage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Shell in the view
static member inline BuildShell(attribCount: int,
?flyoutBackgroundColor: Xamarin.Forms.Color,
?flyoutBackgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?flyoutBackgroundImageAspect: Xamarin.Forms.Aspect,
?flyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?flyoutHeader: ViewElement,
?flyoutHeaderBehavior: Xamarin.Forms.FlyoutHeaderBehavior,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?flyoutIsPresented: bool,
?items: ViewElement list,
?goToAsync: Xamarin.Forms.ShellNavigationState * Fabulous.XamarinForms.InputTypes.AnimationKind,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?navigated: Xamarin.Forms.ShellNavigatedEventArgs -> unit,
?navigating: Xamarin.Forms.ShellNavigatingEventArgs -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match flyoutBackgroundColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutBackgroundImage with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutBackgroundImageAspect with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutBehavior with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutHeader with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutHeaderBehavior with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutIcon with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match flyoutIsPresented with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match items with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match goToAsync with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match navigated with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match navigating with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildPage(attribCount, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding, ?title=title,
?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused, ?created=created)
match flyoutBackgroundColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutBackgroundColorAttribKey, (v))
match flyoutBackgroundImage with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutBackgroundImageAttribKey, (v))
match flyoutBackgroundImageAspect with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutBackgroundImageAspectAttribKey, (v))
match flyoutBehavior with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutBehaviorAttribKey, (v))
match flyoutHeader with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutHeaderAttribKey, (v))
match flyoutHeaderBehavior with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutHeaderBehaviorAttribKey, (v))
match flyoutIcon with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutIconAttribKey, (v))
match flyoutIsPresented with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FlyoutIsPresentedAttribKey, (v))
match items with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsAttribKey, Array.ofList(v))
match goToAsync with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GoToAsyncAttribKey, (v))
match navigated with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellNavigatedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.ShellNavigatedEventArgs>(fun _sender _args -> f _args))(v))
match navigating with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ShellNavigatingAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.ShellNavigatingEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateShell () : Xamarin.Forms.Shell =
new Xamarin.Forms.Shell()
static member UpdateShell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Shell) =
let mutable prevShellNavigatedOpt = ValueNone
let mutable currShellNavigatedOpt = ValueNone
let mutable prevShellNavigatingOpt = ValueNone
let mutable currShellNavigatingOpt = ValueNone
let mutable prevFlyoutBackgroundColorOpt = ValueNone
let mutable currFlyoutBackgroundColorOpt = ValueNone
let mutable prevFlyoutBackgroundImageOpt = ValueNone
let mutable currFlyoutBackgroundImageOpt = ValueNone
let mutable prevFlyoutBackgroundImageAspectOpt = ValueNone
let mutable currFlyoutBackgroundImageAspectOpt = ValueNone
let mutable prevFlyoutBehaviorOpt = ValueNone
let mutable currFlyoutBehaviorOpt = ValueNone
let mutable prevFlyoutHeaderOpt = ValueNone
let mutable currFlyoutHeaderOpt = ValueNone
let mutable prevFlyoutHeaderBehaviorOpt = ValueNone
let mutable currFlyoutHeaderBehaviorOpt = ValueNone
let mutable prevFlyoutIconOpt = ValueNone
let mutable currFlyoutIconOpt = ValueNone
let mutable prevFlyoutIsPresentedOpt = ValueNone
let mutable currFlyoutIsPresentedOpt = ValueNone
let mutable prevItemsOpt = ValueNone
let mutable currItemsOpt = ValueNone
let mutable prevGoToAsyncOpt = ValueNone
let mutable currGoToAsyncOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellNavigatedAttribKey.KeyValue then
currShellNavigatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ShellNavigatedEventArgs>)
if kvp.Key = ViewAttributes.ShellNavigatingAttribKey.KeyValue then
currShellNavigatingOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ShellNavigatingEventArgs>)
if kvp.Key = ViewAttributes.FlyoutBackgroundColorAttribKey.KeyValue then
currFlyoutBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FlyoutBackgroundImageAttribKey.KeyValue then
currFlyoutBackgroundImageOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.FlyoutBackgroundImageAspectAttribKey.KeyValue then
currFlyoutBackgroundImageAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.FlyoutBehaviorAttribKey.KeyValue then
currFlyoutBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutBehavior)
if kvp.Key = ViewAttributes.FlyoutHeaderAttribKey.KeyValue then
currFlyoutHeaderOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.FlyoutHeaderBehaviorAttribKey.KeyValue then
currFlyoutHeaderBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutHeaderBehavior)
if kvp.Key = ViewAttributes.FlyoutIconAttribKey.KeyValue then
currFlyoutIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.FlyoutIsPresentedAttribKey.KeyValue then
currFlyoutIsPresentedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
currItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.GoToAsyncAttribKey.KeyValue then
currGoToAsyncOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ShellNavigationState * Fabulous.XamarinForms.InputTypes.AnimationKind)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ShellNavigatedAttribKey.KeyValue then
prevShellNavigatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ShellNavigatedEventArgs>)
if kvp.Key = ViewAttributes.ShellNavigatingAttribKey.KeyValue then
prevShellNavigatingOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ShellNavigatingEventArgs>)
if kvp.Key = ViewAttributes.FlyoutBackgroundColorAttribKey.KeyValue then
prevFlyoutBackgroundColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.FlyoutBackgroundImageAttribKey.KeyValue then
prevFlyoutBackgroundImageOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.FlyoutBackgroundImageAspectAttribKey.KeyValue then
prevFlyoutBackgroundImageAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.FlyoutBehaviorAttribKey.KeyValue then
prevFlyoutBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutBehavior)
if kvp.Key = ViewAttributes.FlyoutHeaderAttribKey.KeyValue then
prevFlyoutHeaderOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.FlyoutHeaderBehaviorAttribKey.KeyValue then
prevFlyoutHeaderBehaviorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FlyoutHeaderBehavior)
if kvp.Key = ViewAttributes.FlyoutIconAttribKey.KeyValue then
prevFlyoutIconOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.FlyoutIsPresentedAttribKey.KeyValue then
prevFlyoutIsPresentedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ItemsAttribKey.KeyValue then
prevItemsOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.GoToAsyncAttribKey.KeyValue then
prevGoToAsyncOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ShellNavigationState * Fabulous.XamarinForms.InputTypes.AnimationKind)
// Unsubscribe previous event handlers
let shouldUpdateShellNavigated = not ((identical prevShellNavigatedOpt currShellNavigatedOpt))
if shouldUpdateShellNavigated then
match prevShellNavigatedOpt with
| ValueSome prevValue -> target.Navigated.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateShellNavigating = not ((identical prevShellNavigatingOpt currShellNavigatingOpt))
if shouldUpdateShellNavigating then
match prevShellNavigatingOpt with
| ValueSome prevValue -> target.Navigating.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdatePage (prevOpt, curr, target)
// Update properties
match prevFlyoutBackgroundColorOpt, currFlyoutBackgroundColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutBackgroundColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutBackgroundColorProperty
| ValueNone, ValueNone -> ()
match prevFlyoutBackgroundImageOpt, currFlyoutBackgroundImageOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutBackgroundImage <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutBackgroundImageProperty
| ValueNone, ValueNone -> ()
match prevFlyoutBackgroundImageAspectOpt, currFlyoutBackgroundImageAspectOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutBackgroundImageAspect <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutBackgroundImageAspectProperty
| ValueNone, ValueNone -> ()
match prevFlyoutBehaviorOpt, currFlyoutBehaviorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutBehavior <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutBehaviorProperty
| ValueNone, ValueNone -> ()
match prevFlyoutHeaderOpt, currFlyoutHeaderOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.FlyoutHeader)
| _, ValueSome newValue ->
target.FlyoutHeader <- (newValue.Create() :?> obj)
| ValueSome _, ValueNone ->
target.FlyoutHeader <- null
| ValueNone, ValueNone -> ()
match prevFlyoutHeaderBehaviorOpt, currFlyoutHeaderBehaviorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutHeaderBehavior <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutHeaderBehaviorProperty
| ValueNone, ValueNone -> ()
match prevFlyoutIconOpt, currFlyoutIconOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutIcon <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutIconProperty
| ValueNone, ValueNone -> ()
match prevFlyoutIsPresentedOpt, currFlyoutIsPresentedOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FlyoutIsPresented <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Shell.FlyoutIsPresentedProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateShellItems prevItemsOpt currItemsOpt target
(fun _ _ _ -> ())
ViewUpdaters.triggerShellGoToAsync prevGoToAsyncOpt currGoToAsyncOpt target
// Subscribe new event handlers
if shouldUpdateShellNavigated then
match currShellNavigatedOpt with
| ValueSome currValue -> target.Navigated.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateShellNavigating then
match currShellNavigatingOpt with
| ValueSome currValue -> target.Navigating.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructShell(?flyoutBackgroundColor: Xamarin.Forms.Color,
?flyoutBackgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?flyoutBackgroundImageAspect: Xamarin.Forms.Aspect,
?flyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?flyoutHeader: ViewElement,
?flyoutHeaderBehavior: Xamarin.Forms.FlyoutHeaderBehavior,
?flyoutIcon: Fabulous.XamarinForms.InputTypes.Image,
?flyoutIsPresented: bool,
?items: ViewElement list,
?goToAsync: Xamarin.Forms.ShellNavigationState * Fabulous.XamarinForms.InputTypes.AnimationKind,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Shell>,
?tag: obj,
?navigated: Xamarin.Forms.ShellNavigatedEventArgs -> unit,
?navigating: Xamarin.Forms.ShellNavigatingEventArgs -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.Shell -> unit)) =
let attribBuilder = ViewBuilders.BuildShell(0,
?flyoutBackgroundColor=flyoutBackgroundColor,
?flyoutBackgroundImage=flyoutBackgroundImage,
?flyoutBackgroundImageAspect=flyoutBackgroundImageAspect,
?flyoutBehavior=flyoutBehavior,
?flyoutHeader=flyoutHeader,
?flyoutHeaderBehavior=flyoutHeaderBehavior,
?flyoutIcon=flyoutIcon,
?flyoutIsPresented=flyoutIsPresented,
?items=items,
?goToAsync=goToAsync,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Shell>) -> Some ref.Unbox),
?tag=tag,
?navigated=navigated,
?navigating=navigating,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Shell> target))))
ViewElement.Create<Xamarin.Forms.Shell>(ViewBuilders.CreateShell, (fun prevOpt curr target -> ViewBuilders.UpdateShell(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a XFContentPage in the view
static member inline BuildXFContentPage(attribCount: int,
?content: ViewElement,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match content with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildPage(attribCount, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding, ?title=title,
?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused, ?created=created)
match content with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ContentAttribKey, (v))
attribBuilder
static member UpdateXFContentPage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ContentPage) =
let mutable prevContentOpt = ValueNone
let mutable currContentOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ContentAttribKey.KeyValue then
currContentOpt <- ValueSome (kvp.Value :?> ViewElement)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ContentAttribKey.KeyValue then
prevContentOpt <- ValueSome (kvp.Value :?> ViewElement)
// Update inherited members
ViewBuilders.UpdatePage (prevOpt, curr, target)
// Update properties
match prevContentOpt, currContentOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.Content)
| _, ValueSome newValue ->
target.Content <- (newValue.Create() :?> Xamarin.Forms.View)
| ValueSome _, ValueNone ->
target.Content <- null
| ValueNone, ValueNone -> ()
/// Builds the attributes for a ContentPage in the view
static member inline BuildContentPage(attribCount: int,
?content: ViewElement,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?sizeAllocated: System.Tuple<System.Double,System.Double> -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match sizeAllocated with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildXFContentPage(attribCount, ?content=content, ?backgroundImage=backgroundImage, ?icon=icon, ?isBusy=isBusy, ?padding=padding,
?title=title, ?toolbarItems=toolbarItems, ?useSafeArea=useSafeArea, ?hasNavigationBar=hasNavigationBar, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?appearing=appearing, ?disappearing=disappearing, ?focused=focused, ?unfocused=unfocused,
?created=created)
match sizeAllocated with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SizeAllocatedAttribKey, (fun f -> System.EventHandler<System.Tuple<System.Double,System.Double>>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateContentPage () : Fabulous.XamarinForms.CustomContentPage =
new Fabulous.XamarinForms.CustomContentPage()
static member UpdateContentPage (prevOpt: ViewElement voption, curr: ViewElement, target: Fabulous.XamarinForms.CustomContentPage) =
let mutable prevSizeAllocatedOpt = ValueNone
let mutable currSizeAllocatedOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.SizeAllocatedAttribKey.KeyValue then
currSizeAllocatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<System.Tuple<System.Double,System.Double>>)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.SizeAllocatedAttribKey.KeyValue then
prevSizeAllocatedOpt <- ValueSome (kvp.Value :?> System.EventHandler<System.Tuple<System.Double,System.Double>>)
// Unsubscribe previous event handlers
let shouldUpdateSizeAllocated = not ((identical prevSizeAllocatedOpt currSizeAllocatedOpt))
if shouldUpdateSizeAllocated then
match prevSizeAllocatedOpt with
| ValueSome prevValue -> target.SizeAllocated.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateXFContentPage (prevOpt, curr, target)
// Subscribe new event handlers
if shouldUpdateSizeAllocated then
match currSizeAllocatedOpt with
| ValueSome currValue -> target.SizeAllocated.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructContentPage(?content: ViewElement,
?backgroundImage: Fabulous.XamarinForms.InputTypes.Image,
?icon: Fabulous.XamarinForms.InputTypes.Image,
?isBusy: bool,
?padding: Xamarin.Forms.Thickness,
?title: string,
?toolbarItems: ViewElement list,
?useSafeArea: bool,
?hasNavigationBar: bool,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Fabulous.XamarinForms.CustomContentPage>,
?tag: obj,
?sizeAllocated: System.Tuple<System.Double,System.Double> -> unit,
?appearing: unit -> unit,
?disappearing: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Fabulous.XamarinForms.CustomContentPage -> unit)) =
let attribBuilder = ViewBuilders.BuildContentPage(0,
?content=content,
?backgroundImage=backgroundImage,
?icon=icon,
?isBusy=isBusy,
?padding=padding,
?title=title,
?toolbarItems=toolbarItems,
?useSafeArea=useSafeArea,
?hasNavigationBar=hasNavigationBar,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Fabulous.XamarinForms.CustomContentPage>) -> Some ref.Unbox),
?tag=tag,
?sizeAllocated=sizeAllocated,
?appearing=appearing,
?disappearing=disappearing,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Fabulous.XamarinForms.CustomContentPage> target))))
ViewElement.Create<Fabulous.XamarinForms.CustomContentPage>(ViewBuilders.CreateContentPage, (fun prevOpt curr target -> ViewBuilders.UpdateContentPage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a View in the view
static member inline BuildView(attribCount: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match gestureRecognizers with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match horizontalOptions with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match margin with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match verticalOptions with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildVisualElement(attribCount, ?anchorX=anchorX, ?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection,
?height=height, ?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible,
?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation,
?rotationX=rotationX, ?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY,
?styles=styles, ?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY,
?visual=visual, ?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match gestureRecognizers with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GestureRecognizersAttribKey, Array.ofList(v))
match horizontalOptions with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HorizontalOptionsAttribKey, (v))
match margin with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MarginAttribKey, (v))
match verticalOptions with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VerticalOptionsAttribKey, (v))
attribBuilder
static member UpdateView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.View) =
let mutable prevGestureRecognizersOpt = ValueNone
let mutable currGestureRecognizersOpt = ValueNone
let mutable prevHorizontalOptionsOpt = ValueNone
let mutable currHorizontalOptionsOpt = ValueNone
let mutable prevMarginOpt = ValueNone
let mutable currMarginOpt = ValueNone
let mutable prevVerticalOptionsOpt = ValueNone
let mutable currVerticalOptionsOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.GestureRecognizersAttribKey.KeyValue then
currGestureRecognizersOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.HorizontalOptionsAttribKey.KeyValue then
currHorizontalOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.LayoutOptions)
if kvp.Key = ViewAttributes.MarginAttribKey.KeyValue then
currMarginOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.VerticalOptionsAttribKey.KeyValue then
currVerticalOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.LayoutOptions)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.GestureRecognizersAttribKey.KeyValue then
prevGestureRecognizersOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.HorizontalOptionsAttribKey.KeyValue then
prevHorizontalOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.LayoutOptions)
if kvp.Key = ViewAttributes.MarginAttribKey.KeyValue then
prevMarginOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.VerticalOptionsAttribKey.KeyValue then
prevVerticalOptionsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.LayoutOptions)
// Update inherited members
ViewBuilders.UpdateVisualElement (prevOpt, curr, target)
// Update properties
ViewUpdaters.updateCollectionGeneric prevGestureRecognizersOpt currGestureRecognizersOpt target.GestureRecognizers
(fun (x:ViewElement) -> x.Create() :?> Xamarin.Forms.IGestureRecognizer)
(fun _ _ _ -> ())
ViewHelpers.canReuseView
ViewUpdaters.updateChild
match prevHorizontalOptionsOpt, currHorizontalOptionsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HorizontalOptions <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.View.HorizontalOptionsProperty
| ValueNone, ValueNone -> ()
match prevMarginOpt, currMarginOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Margin <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.View.MarginProperty
| ValueNone, ValueNone -> ()
match prevVerticalOptionsOpt, currVerticalOptionsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.VerticalOptions <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.View.VerticalOptionsProperty
| ValueNone, ValueNone -> ()
/// Builds the attributes for a ActivityIndicator in the view
static member inline BuildActivityIndicator(attribCount: int,
?color: Xamarin.Forms.Color,
?isRunning: bool,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match color with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isRunning with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match color with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ColorAttribKey, (v))
match isRunning with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsRunningAttribKey, (v))
attribBuilder
static member CreateActivityIndicator () : Xamarin.Forms.ActivityIndicator =
new Xamarin.Forms.ActivityIndicator()
static member UpdateActivityIndicator (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ActivityIndicator) =
let mutable prevColorOpt = ValueNone
let mutable currColorOpt = ValueNone
let mutable prevIsRunningOpt = ValueNone
let mutable currIsRunningOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
currColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.IsRunningAttribKey.KeyValue then
currIsRunningOpt <- ValueSome (kvp.Value :?> bool)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
prevColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.IsRunningAttribKey.KeyValue then
prevIsRunningOpt <- ValueSome (kvp.Value :?> bool)
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevColorOpt, currColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Color <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ActivityIndicator.ColorProperty
| ValueNone, ValueNone -> ()
match prevIsRunningOpt, currIsRunningOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsRunning <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ActivityIndicator.IsRunningProperty
| ValueNone, ValueNone -> ()
static member inline ConstructActivityIndicator(?color: Xamarin.Forms.Color,
?isRunning: bool,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ActivityIndicator>,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.ActivityIndicator -> unit)) =
let attribBuilder = ViewBuilders.BuildActivityIndicator(0,
?color=color,
?isRunning=isRunning,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ActivityIndicator>) -> Some ref.Unbox),
?tag=tag,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ActivityIndicator> target))))
ViewElement.Create<Xamarin.Forms.ActivityIndicator>(ViewBuilders.CreateActivityIndicator, (fun prevOpt curr target -> ViewBuilders.UpdateActivityIndicator(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a BoxView in the view
static member inline BuildBoxView(attribCount: int,
?color: Xamarin.Forms.Color,
?cornerRadius: Xamarin.Forms.CornerRadius,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match color with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match cornerRadius with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match color with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ColorAttribKey, (v))
match cornerRadius with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BoxViewCornerRadiusAttribKey, (v))
attribBuilder
static member CreateBoxView () : Xamarin.Forms.BoxView =
new Xamarin.Forms.BoxView()
static member UpdateBoxView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.BoxView) =
let mutable prevColorOpt = ValueNone
let mutable currColorOpt = ValueNone
let mutable prevBoxViewCornerRadiusOpt = ValueNone
let mutable currBoxViewCornerRadiusOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
currColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BoxViewCornerRadiusAttribKey.KeyValue then
currBoxViewCornerRadiusOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.CornerRadius)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
prevColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BoxViewCornerRadiusAttribKey.KeyValue then
prevBoxViewCornerRadiusOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.CornerRadius)
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevColorOpt, currColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Color <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BoxView.ColorProperty
| ValueNone, ValueNone -> ()
match prevBoxViewCornerRadiusOpt, currBoxViewCornerRadiusOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CornerRadius <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.BoxView.CornerRadiusProperty
| ValueNone, ValueNone -> ()
static member inline ConstructBoxView(?color: Xamarin.Forms.Color,
?cornerRadius: Xamarin.Forms.CornerRadius,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.BoxView>,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.BoxView -> unit)) =
let attribBuilder = ViewBuilders.BuildBoxView(0,
?color=color,
?cornerRadius=cornerRadius,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.BoxView>) -> Some ref.Unbox),
?tag=tag,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.BoxView> target))))
ViewElement.Create<Xamarin.Forms.BoxView>(ViewBuilders.CreateBoxView, (fun prevOpt curr target -> ViewBuilders.UpdateBoxView(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Button in the view
static member inline BuildButton(attribCount: int,
?borderColor: Xamarin.Forms.Color,
?borderWidth: float,
?characterSpacing: float,
?command: unit -> unit,
?commandCanExecute: bool,
?contentLayout: Xamarin.Forms.Button.ButtonContentLayout,
?cornerRadius: int,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?image: Fabulous.XamarinForms.InputTypes.Image,
?padding: Xamarin.Forms.Thickness,
?text: string,
?textColor: Xamarin.Forms.Color,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match borderColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match borderWidth with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match contentLayout with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match cornerRadius with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match image with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match padding with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match borderColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BorderColorAttribKey, (v))
match borderWidth with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BorderWidthAttribKey, (v))
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match contentLayout with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ContentLayoutAttribKey, (v))
match cornerRadius with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ButtonCornerRadiusAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match image with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ImageSourceAttribKey, (v))
match padding with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PaddingAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
attribBuilder
static member CreateButton () : Xamarin.Forms.Button =
new Xamarin.Forms.Button()
static member UpdateButton (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Button) =
let mutable prevBorderColorOpt = ValueNone
let mutable currBorderColorOpt = ValueNone
let mutable prevBorderWidthOpt = ValueNone
let mutable currBorderWidthOpt = ValueNone
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevContentLayoutOpt = ValueNone
let mutable currContentLayoutOpt = ValueNone
let mutable prevButtonCornerRadiusOpt = ValueNone
let mutable currButtonCornerRadiusOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevImageSourceOpt = ValueNone
let mutable currImageSourceOpt = ValueNone
let mutable prevPaddingOpt = ValueNone
let mutable currPaddingOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.BorderColorAttribKey.KeyValue then
currBorderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BorderWidthAttribKey.KeyValue then
currBorderWidthOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ContentLayoutAttribKey.KeyValue then
currContentLayoutOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Button.ButtonContentLayout)
if kvp.Key = ViewAttributes.ButtonCornerRadiusAttribKey.KeyValue then
currButtonCornerRadiusOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
currImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
currPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.BorderColorAttribKey.KeyValue then
prevBorderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BorderWidthAttribKey.KeyValue then
prevBorderWidthOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ContentLayoutAttribKey.KeyValue then
prevContentLayoutOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Button.ButtonContentLayout)
if kvp.Key = ViewAttributes.ButtonCornerRadiusAttribKey.KeyValue then
prevButtonCornerRadiusOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
prevImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
prevPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevBorderColorOpt, currBorderColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BorderColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.BorderColorProperty
| ValueNone, ValueNone -> ()
match prevBorderWidthOpt, currBorderWidthOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BorderWidth <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.BorderWidthProperty
| ValueNone, ValueNone -> ()
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.Button) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevContentLayoutOpt, currContentLayoutOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ContentLayout <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.ContentLayoutProperty
| ValueNone, ValueNone -> ()
match prevButtonCornerRadiusOpt, currButtonCornerRadiusOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CornerRadius <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.CornerRadiusProperty
| ValueNone, ValueNone -> ()
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevImageSourceOpt, currImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ImageSource <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.ImageSourceProperty
| ValueNone, ValueNone -> ()
match prevPaddingOpt, currPaddingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Padding <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.PaddingProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Button.TextColorProperty
| ValueNone, ValueNone -> ()
static member inline ConstructButton(?borderColor: Xamarin.Forms.Color,
?borderWidth: float,
?characterSpacing: float,
?command: unit -> unit,
?commandCanExecute: bool,
?contentLayout: Xamarin.Forms.Button.ButtonContentLayout,
?cornerRadius: int,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?image: Fabulous.XamarinForms.InputTypes.Image,
?padding: Xamarin.Forms.Thickness,
?text: string,
?textColor: Xamarin.Forms.Color,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Button>,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.Button -> unit)) =
let attribBuilder = ViewBuilders.BuildButton(0,
?borderColor=borderColor,
?borderWidth=borderWidth,
?characterSpacing=characterSpacing,
?command=command,
?commandCanExecute=commandCanExecute,
?contentLayout=contentLayout,
?cornerRadius=cornerRadius,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?image=image,
?padding=padding,
?text=text,
?textColor=textColor,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Button>) -> Some ref.Unbox),
?tag=tag,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Button> target))))
ViewElement.Create<Xamarin.Forms.Button>(ViewBuilders.CreateButton, (fun prevOpt curr target -> ViewBuilders.UpdateButton(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a CheckBox in the view
static member inline BuildCheckBox(attribCount: int,
?color: Xamarin.Forms.Color,
?isChecked: bool,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?checkedChanged: Xamarin.Forms.CheckedChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match color with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isChecked with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match checkedChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match color with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ColorAttribKey, (v))
match isChecked with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsCheckedAttribKey, (v))
match checkedChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CheckedChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.CheckedChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateCheckBox () : Xamarin.Forms.CheckBox =
new Xamarin.Forms.CheckBox()
static member UpdateCheckBox (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.CheckBox) =
let mutable prevCheckedChangedOpt = ValueNone
let mutable currCheckedChangedOpt = ValueNone
let mutable prevColorOpt = ValueNone
let mutable currColorOpt = ValueNone
let mutable prevIsCheckedOpt = ValueNone
let mutable currIsCheckedOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CheckedChangedAttribKey.KeyValue then
currCheckedChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.CheckedChangedEventArgs>)
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
currColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.IsCheckedAttribKey.KeyValue then
currIsCheckedOpt <- ValueSome (kvp.Value :?> bool)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CheckedChangedAttribKey.KeyValue then
prevCheckedChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.CheckedChangedEventArgs>)
if kvp.Key = ViewAttributes.ColorAttribKey.KeyValue then
prevColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.IsCheckedAttribKey.KeyValue then
prevIsCheckedOpt <- ValueSome (kvp.Value :?> bool)
// Unsubscribe previous event handlers
let shouldUpdateCheckedChanged = not ((identical prevCheckedChangedOpt currCheckedChangedOpt) && (identical prevIsCheckedOpt currIsCheckedOpt))
if shouldUpdateCheckedChanged then
match prevCheckedChangedOpt with
| ValueSome prevValue -> target.CheckedChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevColorOpt, currColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Color <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CheckBox.ColorProperty
| ValueNone, ValueNone -> ()
match prevIsCheckedOpt, currIsCheckedOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsChecked <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CheckBox.IsCheckedProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCheckedChanged then
match currCheckedChangedOpt with
| ValueSome currValue -> target.CheckedChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructCheckBox(?color: Xamarin.Forms.Color,
?isChecked: bool,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.CheckBox>,
?tag: obj,
?checkedChanged: Xamarin.Forms.CheckedChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.CheckBox -> unit)) =
let attribBuilder = ViewBuilders.BuildCheckBox(0,
?color=color,
?isChecked=isChecked,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.CheckBox>) -> Some ref.Unbox),
?tag=tag,
?checkedChanged=checkedChanged,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.CheckBox> target))))
ViewElement.Create<Xamarin.Forms.CheckBox>(ViewBuilders.CreateCheckBox, (fun prevOpt curr target -> ViewBuilders.UpdateCheckBox(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a DatePicker in the view
static member inline BuildDatePicker(attribCount: int,
?characterSpacing: float,
?date: System.DateTime,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?format: string,
?maximumDate: System.DateTime,
?minimumDate: System.DateTime,
?textColor: Xamarin.Forms.Color,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?dateSelected: Xamarin.Forms.DateChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match date with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match format with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match maximumDate with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match minimumDate with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match dateSelected with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match date with None -> () | Some v -> attribBuilder.Add(ViewAttributes.DateAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match format with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FormatAttribKey, (v))
match maximumDate with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MaximumDateAttribKey, (v))
match minimumDate with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MinimumDateAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
match dateSelected with None -> () | Some v -> attribBuilder.Add(ViewAttributes.DateSelectedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.DateChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateDatePicker () : Xamarin.Forms.DatePicker =
new Xamarin.Forms.DatePicker()
static member UpdateDatePicker (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.DatePicker) =
let mutable prevDateSelectedOpt = ValueNone
let mutable currDateSelectedOpt = ValueNone
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevDateOpt = ValueNone
let mutable currDateOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevFormatOpt = ValueNone
let mutable currFormatOpt = ValueNone
let mutable prevMaximumDateOpt = ValueNone
let mutable currMaximumDateOpt = ValueNone
let mutable prevMinimumDateOpt = ValueNone
let mutable currMinimumDateOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.DateSelectedAttribKey.KeyValue then
currDateSelectedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.DateChangedEventArgs>)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.DateAttribKey.KeyValue then
currDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.FormatAttribKey.KeyValue then
currFormatOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.MaximumDateAttribKey.KeyValue then
currMaximumDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.MinimumDateAttribKey.KeyValue then
currMinimumDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.DateSelectedAttribKey.KeyValue then
prevDateSelectedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.DateChangedEventArgs>)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.DateAttribKey.KeyValue then
prevDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.FormatAttribKey.KeyValue then
prevFormatOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.MaximumDateAttribKey.KeyValue then
prevMaximumDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.MinimumDateAttribKey.KeyValue then
prevMinimumDateOpt <- ValueSome (kvp.Value :?> System.DateTime)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Unsubscribe previous event handlers
let shouldUpdateDateSelected = not ((identical prevDateSelectedOpt currDateSelectedOpt) && (identical prevDateOpt currDateOpt))
if shouldUpdateDateSelected then
match prevDateSelectedOpt with
| ValueSome prevValue -> target.DateSelected.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
match prevDateOpt, currDateOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Date <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.DateProperty
| ValueNone, ValueNone -> ()
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevFormatOpt, currFormatOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Format <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.FormatProperty
| ValueNone, ValueNone -> ()
match prevMaximumDateOpt, currMaximumDateOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MaximumDate <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.MaximumDateProperty
| ValueNone, ValueNone -> ()
match prevMinimumDateOpt, currMinimumDateOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MinimumDate <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.MinimumDateProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.DatePicker.TextColorProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateDateSelected then
match currDateSelectedOpt with
| ValueSome currValue -> target.DateSelected.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructDatePicker(?characterSpacing: float,
?date: System.DateTime,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?format: string,
?maximumDate: System.DateTime,
?minimumDate: System.DateTime,
?textColor: Xamarin.Forms.Color,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.DatePicker>,
?tag: obj,
?dateSelected: Xamarin.Forms.DateChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.DatePicker -> unit)) =
let attribBuilder = ViewBuilders.BuildDatePicker(0,
?characterSpacing=characterSpacing,
?date=date,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?format=format,
?maximumDate=maximumDate,
?minimumDate=minimumDate,
?textColor=textColor,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.DatePicker>) -> Some ref.Unbox),
?tag=tag,
?dateSelected=dateSelected,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.DatePicker> target))))
ViewElement.Create<Xamarin.Forms.DatePicker>(ViewBuilders.CreateDatePicker, (fun prevOpt curr target -> ViewBuilders.UpdateDatePicker(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Image in the view
static member inline BuildImage(attribCount: int,
?aspect: Xamarin.Forms.Aspect,
?isOpaque: bool,
?source: Fabulous.XamarinForms.InputTypes.Image,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match aspect with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isOpaque with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match source with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match aspect with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AspectAttribKey, (v))
match isOpaque with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsOpaqueAttribKey, (v))
match source with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ImageSourceAttribKey, (v))
attribBuilder
static member CreateImage () : Xamarin.Forms.Image =
new Xamarin.Forms.Image()
static member UpdateImage (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Image) =
let mutable prevAspectOpt = ValueNone
let mutable currAspectOpt = ValueNone
let mutable prevIsOpaqueOpt = ValueNone
let mutable currIsOpaqueOpt = ValueNone
let mutable prevImageSourceOpt = ValueNone
let mutable currImageSourceOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.AspectAttribKey.KeyValue then
currAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.IsOpaqueAttribKey.KeyValue then
currIsOpaqueOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
currImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.AspectAttribKey.KeyValue then
prevAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.IsOpaqueAttribKey.KeyValue then
prevIsOpaqueOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ImageSourceAttribKey.KeyValue then
prevImageSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevAspectOpt, currAspectOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Aspect <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Image.AspectProperty
| ValueNone, ValueNone -> ()
match prevIsOpaqueOpt, currIsOpaqueOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsOpaque <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Image.IsOpaqueProperty
| ValueNone, ValueNone -> ()
match prevImageSourceOpt, currImageSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Source <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Image.SourceProperty
| ValueNone, ValueNone -> ()
static member inline ConstructImage(?aspect: Xamarin.Forms.Aspect,
?isOpaque: bool,
?source: Fabulous.XamarinForms.InputTypes.Image,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Image>,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.Image -> unit)) =
let attribBuilder = ViewBuilders.BuildImage(0,
?aspect=aspect,
?isOpaque=isOpaque,
?source=source,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Image>) -> Some ref.Unbox),
?tag=tag,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Image> target))))
ViewElement.Create<Xamarin.Forms.Image>(ViewBuilders.CreateImage, (fun prevOpt curr target -> ViewBuilders.UpdateImage(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ImageButton in the view
static member inline BuildImageButton(attribCount: int,
?aspect: Xamarin.Forms.Aspect,
?borderColor: Xamarin.Forms.Color,
?borderWidth: float,
?command: unit -> unit,
?commandCanExecute: bool,
?cornerRadius: int,
?isOpaque: bool,
?padding: Xamarin.Forms.Thickness,
?source: Fabulous.XamarinForms.InputTypes.Image,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?clicked: unit -> unit,
?pressed: unit -> unit,
?released: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match aspect with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match borderColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match borderWidth with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match command with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match commandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match cornerRadius with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isOpaque with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match padding with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match source with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match clicked with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match pressed with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match released with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match aspect with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AspectAttribKey, (v))
match borderColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BorderColorAttribKey, (v))
match borderWidth with None -> () | Some v -> attribBuilder.Add(ViewAttributes.BorderWidthAttribKey, (v))
match command with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandAttribKey, (v))
match commandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CommandCanExecuteAttribKey, (v))
match cornerRadius with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ImageButtonCornerRadiusAttribKey, (v))
match isOpaque with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsOpaqueAttribKey, (v))
match padding with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PaddingAttribKey, (v))
match source with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ImageButtonSourceAttribKey, (v))
match clicked with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ClickedAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
match pressed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PressedAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
match released with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ReleasedAttribKey, (fun f -> System.EventHandler(fun _sender _args -> f()))(v))
attribBuilder
static member CreateImageButton () : Xamarin.Forms.ImageButton =
new Xamarin.Forms.ImageButton()
static member UpdateImageButton (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ImageButton) =
let mutable prevClickedOpt = ValueNone
let mutable currClickedOpt = ValueNone
let mutable prevPressedOpt = ValueNone
let mutable currPressedOpt = ValueNone
let mutable prevReleasedOpt = ValueNone
let mutable currReleasedOpt = ValueNone
let mutable prevAspectOpt = ValueNone
let mutable currAspectOpt = ValueNone
let mutable prevBorderColorOpt = ValueNone
let mutable currBorderColorOpt = ValueNone
let mutable prevBorderWidthOpt = ValueNone
let mutable currBorderWidthOpt = ValueNone
let mutable prevCommandOpt = ValueNone
let mutable currCommandOpt = ValueNone
let mutable prevCommandCanExecuteOpt = ValueNone
let mutable currCommandCanExecuteOpt = ValueNone
let mutable prevImageButtonCornerRadiusOpt = ValueNone
let mutable currImageButtonCornerRadiusOpt = ValueNone
let mutable prevIsOpaqueOpt = ValueNone
let mutable currIsOpaqueOpt = ValueNone
let mutable prevPaddingOpt = ValueNone
let mutable currPaddingOpt = ValueNone
let mutable prevImageButtonSourceOpt = ValueNone
let mutable currImageButtonSourceOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ClickedAttribKey.KeyValue then
currClickedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.PressedAttribKey.KeyValue then
currPressedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.ReleasedAttribKey.KeyValue then
currReleasedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.AspectAttribKey.KeyValue then
currAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.BorderColorAttribKey.KeyValue then
currBorderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BorderWidthAttribKey.KeyValue then
currBorderWidthOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
currCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
currCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ImageButtonCornerRadiusAttribKey.KeyValue then
currImageButtonCornerRadiusOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.IsOpaqueAttribKey.KeyValue then
currIsOpaqueOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
currPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.ImageButtonSourceAttribKey.KeyValue then
currImageButtonSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ClickedAttribKey.KeyValue then
prevClickedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.PressedAttribKey.KeyValue then
prevPressedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.ReleasedAttribKey.KeyValue then
prevReleasedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.AspectAttribKey.KeyValue then
prevAspectOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Aspect)
if kvp.Key = ViewAttributes.BorderColorAttribKey.KeyValue then
prevBorderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.BorderWidthAttribKey.KeyValue then
prevBorderWidthOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.CommandAttribKey.KeyValue then
prevCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.CommandCanExecuteAttribKey.KeyValue then
prevCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ImageButtonCornerRadiusAttribKey.KeyValue then
prevImageButtonCornerRadiusOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.IsOpaqueAttribKey.KeyValue then
prevIsOpaqueOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PaddingAttribKey.KeyValue then
prevPaddingOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.ImageButtonSourceAttribKey.KeyValue then
prevImageButtonSourceOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.Image)
// Unsubscribe previous event handlers
let shouldUpdateClicked = not ((identical prevClickedOpt currClickedOpt))
if shouldUpdateClicked then
match prevClickedOpt with
| ValueSome prevValue -> target.Clicked.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdatePressed = not ((identical prevPressedOpt currPressedOpt))
if shouldUpdatePressed then
match prevPressedOpt with
| ValueSome prevValue -> target.Pressed.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateReleased = not ((identical prevReleasedOpt currReleasedOpt))
if shouldUpdateReleased then
match prevReleasedOpt with
| ValueSome prevValue -> target.Released.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevAspectOpt, currAspectOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Aspect <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.AspectProperty
| ValueNone, ValueNone -> ()
match prevBorderColorOpt, currBorderColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BorderColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.BorderColorProperty
| ValueNone, ValueNone -> ()
match prevBorderWidthOpt, currBorderWidthOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.BorderWidth <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.BorderWidthProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevCommandOpt currCommandOpt target
ViewUpdaters.updateCommand prevCommandOpt currCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.ImageButton) cmd -> target.Command <- cmd) prevCommandCanExecuteOpt currCommandCanExecuteOpt target
match prevImageButtonCornerRadiusOpt, currImageButtonCornerRadiusOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CornerRadius <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.CornerRadiusProperty
| ValueNone, ValueNone -> ()
match prevIsOpaqueOpt, currIsOpaqueOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsOpaque <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.IsOpaqueProperty
| ValueNone, ValueNone -> ()
match prevPaddingOpt, currPaddingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Padding <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.PaddingProperty
| ValueNone, ValueNone -> ()
match prevImageButtonSourceOpt, currImageButtonSourceOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Source <- ViewConverters.convertFabulousImageToXamarinFormsImageSource currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ImageButton.SourceProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateClicked then
match currClickedOpt with
| ValueSome currValue -> target.Clicked.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdatePressed then
match currPressedOpt with
| ValueSome currValue -> target.Pressed.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateReleased then
match currReleasedOpt with
| ValueSome currValue -> target.Released.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructImageButton(?aspect: Xamarin.Forms.Aspect,
?borderColor: Xamarin.Forms.Color,
?borderWidth: float,
?command: unit -> unit,
?commandCanExecute: bool,
?cornerRadius: int,
?isOpaque: bool,
?padding: Xamarin.Forms.Thickness,
?source: Fabulous.XamarinForms.InputTypes.Image,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.ImageButton>,
?tag: obj,
?clicked: unit -> unit,
?pressed: unit -> unit,
?released: unit -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.ImageButton -> unit)) =
let attribBuilder = ViewBuilders.BuildImageButton(0,
?aspect=aspect,
?borderColor=borderColor,
?borderWidth=borderWidth,
?command=command,
?commandCanExecute=commandCanExecute,
?cornerRadius=cornerRadius,
?isOpaque=isOpaque,
?padding=padding,
?source=source,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.ImageButton>) -> Some ref.Unbox),
?tag=tag,
?clicked=clicked,
?pressed=pressed,
?released=released,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.ImageButton> target))))
ViewElement.Create<Xamarin.Forms.ImageButton>(ViewBuilders.CreateImageButton, (fun prevOpt curr target -> ViewBuilders.UpdateImageButton(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a InputView in the view
static member inline BuildInputView(attribCount: int,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match isReadOnly with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isSpellCheckEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match keyboard with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match maxLength with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match isReadOnly with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsReadOnlyAttribKey, (v))
match isSpellCheckEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsSpellCheckEnabledAttribKey, (v))
match keyboard with None -> () | Some v -> attribBuilder.Add(ViewAttributes.KeyboardAttribKey, (v))
match maxLength with None -> () | Some v -> attribBuilder.Add(ViewAttributes.MaxLengthAttribKey, (v))
attribBuilder
static member UpdateInputView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.InputView) =
let mutable prevIsReadOnlyOpt = ValueNone
let mutable currIsReadOnlyOpt = ValueNone
let mutable prevIsSpellCheckEnabledOpt = ValueNone
let mutable currIsSpellCheckEnabledOpt = ValueNone
let mutable prevKeyboardOpt = ValueNone
let mutable currKeyboardOpt = ValueNone
let mutable prevMaxLengthOpt = ValueNone
let mutable currMaxLengthOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.IsReadOnlyAttribKey.KeyValue then
currIsReadOnlyOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsSpellCheckEnabledAttribKey.KeyValue then
currIsSpellCheckEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.KeyboardAttribKey.KeyValue then
currKeyboardOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Keyboard)
if kvp.Key = ViewAttributes.MaxLengthAttribKey.KeyValue then
currMaxLengthOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.IsReadOnlyAttribKey.KeyValue then
prevIsReadOnlyOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsSpellCheckEnabledAttribKey.KeyValue then
prevIsSpellCheckEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.KeyboardAttribKey.KeyValue then
prevKeyboardOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Keyboard)
if kvp.Key = ViewAttributes.MaxLengthAttribKey.KeyValue then
prevMaxLengthOpt <- ValueSome (kvp.Value :?> int)
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevIsReadOnlyOpt, currIsReadOnlyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsReadOnly <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.InputView.IsReadOnlyProperty
| ValueNone, ValueNone -> ()
match prevIsSpellCheckEnabledOpt, currIsSpellCheckEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsSpellCheckEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.InputView.IsSpellCheckEnabledProperty
| ValueNone, ValueNone -> ()
match prevKeyboardOpt, currKeyboardOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Keyboard <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.InputView.KeyboardProperty
| ValueNone, ValueNone -> ()
match prevMaxLengthOpt, currMaxLengthOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.MaxLength <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.InputView.MaxLengthProperty
| ValueNone, ValueNone -> ()
/// Builds the attributes for a Editor in the view
static member inline BuildEditor(attribCount: int,
?autoSize: Xamarin.Forms.EditorAutoSizeOption,
?characterSpacing: float,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?isTextPredictionEnabled: bool,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?completed: string -> unit,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match autoSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isTextPredictionEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholder with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholderColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match completed with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildInputView(attribCount, ?isReadOnly=isReadOnly, ?isSpellCheckEnabled=isSpellCheckEnabled, ?keyboard=keyboard, ?maxLength=maxLength, ?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?focused=focused, ?unfocused=unfocused, ?created=created)
match autoSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.AutoSizeAttribKey, (v))
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match isTextPredictionEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsTextPredictionEnabledAttribKey, (v))
match placeholder with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderAttribKey, (v))
match placeholderColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderColorAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
match completed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CompletedAttribKey, ViewConverters.makeEditorCompletedEventHandler(v))
match textChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateEditor () : Xamarin.Forms.Editor =
new Xamarin.Forms.Editor()
static member UpdateEditor (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Editor) =
let mutable prevCompletedOpt = ValueNone
let mutable currCompletedOpt = ValueNone
let mutable prevTextChangedOpt = ValueNone
let mutable currTextChangedOpt = ValueNone
let mutable prevAutoSizeOpt = ValueNone
let mutable currAutoSizeOpt = ValueNone
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevIsTextPredictionEnabledOpt = ValueNone
let mutable currIsTextPredictionEnabledOpt = ValueNone
let mutable prevPlaceholderOpt = ValueNone
let mutable currPlaceholderOpt = ValueNone
let mutable prevPlaceholderColorOpt = ValueNone
let mutable currPlaceholderColorOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
currCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
currTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.AutoSizeAttribKey.KeyValue then
currAutoSizeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.EditorAutoSizeOption)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.IsTextPredictionEnabledAttribKey.KeyValue then
currIsTextPredictionEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
currPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
currPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
prevCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
prevTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.AutoSizeAttribKey.KeyValue then
prevAutoSizeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.EditorAutoSizeOption)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.IsTextPredictionEnabledAttribKey.KeyValue then
prevIsTextPredictionEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
prevPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
prevPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
// Unsubscribe previous event handlers
let shouldUpdateCompleted = not ((identical prevCompletedOpt currCompletedOpt))
if shouldUpdateCompleted then
match prevCompletedOpt with
| ValueSome prevValue -> target.Completed.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateTextChanged = not ((identical prevTextChangedOpt currTextChangedOpt) && (identical prevTextOpt currTextOpt))
if shouldUpdateTextChanged then
match prevTextChangedOpt with
| ValueSome prevValue -> target.TextChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateInputView (prevOpt, curr, target)
// Update properties
match prevAutoSizeOpt, currAutoSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.AutoSize <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.AutoSizeProperty
| ValueNone, ValueNone -> ()
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevIsTextPredictionEnabledOpt, currIsTextPredictionEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsTextPredictionEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.IsTextPredictionEnabledProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderOpt, currPlaceholderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Placeholder <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.PlaceholderProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderColorOpt, currPlaceholderColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.PlaceholderColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.PlaceholderColorProperty
| ValueNone, ValueNone -> ()
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Editor.TextColorProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCompleted then
match currCompletedOpt with
| ValueSome currValue -> target.Completed.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateTextChanged then
match currTextChangedOpt with
| ValueSome currValue -> target.TextChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructEditor(?autoSize: Xamarin.Forms.EditorAutoSizeOption,
?characterSpacing: float,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?isTextPredictionEnabled: bool,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?text: string,
?textColor: Xamarin.Forms.Color,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Editor>,
?tag: obj,
?completed: string -> unit,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.Editor -> unit)) =
let attribBuilder = ViewBuilders.BuildEditor(0,
?autoSize=autoSize,
?characterSpacing=characterSpacing,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?isTextPredictionEnabled=isTextPredictionEnabled,
?placeholder=placeholder,
?placeholderColor=placeholderColor,
?text=text,
?textColor=textColor,
?isReadOnly=isReadOnly,
?isSpellCheckEnabled=isSpellCheckEnabled,
?keyboard=keyboard,
?maxLength=maxLength,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Editor>) -> Some ref.Unbox),
?tag=tag,
?completed=completed,
?textChanged=textChanged,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Editor> target))))
ViewElement.Create<Xamarin.Forms.Editor>(ViewBuilders.CreateEditor, (fun prevOpt curr target -> ViewBuilders.UpdateEditor(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a Entry in the view
static member inline BuildEntry(attribCount: int,
?characterSpacing: float,
?clearButtonVisibility: Xamarin.Forms.ClearButtonVisibility,
?cursorPosition: int,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?isPassword: bool,
?isTextPredictionEnabled: bool,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?returnCommand: unit -> unit,
?returnCommandCanExecute: bool,
?returnType: Xamarin.Forms.ReturnType,
?selectionLength: int,
?text: string,
?textColor: Xamarin.Forms.Color,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?completed: string -> unit,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match clearButtonVisibility with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match cursorPosition with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match horizontalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isPassword with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isTextPredictionEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholder with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholderColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match returnCommand with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match returnCommandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match returnType with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match selectionLength with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match verticalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match completed with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildInputView(attribCount, ?isReadOnly=isReadOnly, ?isSpellCheckEnabled=isSpellCheckEnabled, ?keyboard=keyboard, ?maxLength=maxLength, ?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?focused=focused, ?unfocused=unfocused, ?created=created)
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match clearButtonVisibility with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ClearButtonVisibilityAttribKey, (v))
match cursorPosition with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CursorPositionAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match horizontalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HorizontalTextAlignmentAttribKey, (v))
match isPassword with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsPasswordAttribKey, (v))
match isTextPredictionEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsTextPredictionEnabledAttribKey, (v))
match placeholder with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderAttribKey, (v))
match placeholderColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderColorAttribKey, (v))
match returnCommand with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ReturnCommandAttribKey, (v))
match returnCommandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ReturnCommandCanExecuteAttribKey, (v))
match returnType with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ReturnTypeAttribKey, (v))
match selectionLength with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectionLengthAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
match verticalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VerticalTextAlignmentAttribKey, (v))
match completed with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CompletedAttribKey, ViewConverters.makeEntryCompletedEventHandler(v))
match textChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateEntry () : Xamarin.Forms.Entry =
new Xamarin.Forms.Entry()
static member UpdateEntry (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.Entry) =
let mutable prevCompletedOpt = ValueNone
let mutable currCompletedOpt = ValueNone
let mutable prevTextChangedOpt = ValueNone
let mutable currTextChangedOpt = ValueNone
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevClearButtonVisibilityOpt = ValueNone
let mutable currClearButtonVisibilityOpt = ValueNone
let mutable prevCursorPositionOpt = ValueNone
let mutable currCursorPositionOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevHorizontalTextAlignmentOpt = ValueNone
let mutable currHorizontalTextAlignmentOpt = ValueNone
let mutable prevIsPasswordOpt = ValueNone
let mutable currIsPasswordOpt = ValueNone
let mutable prevIsTextPredictionEnabledOpt = ValueNone
let mutable currIsTextPredictionEnabledOpt = ValueNone
let mutable prevPlaceholderOpt = ValueNone
let mutable currPlaceholderOpt = ValueNone
let mutable prevPlaceholderColorOpt = ValueNone
let mutable currPlaceholderColorOpt = ValueNone
let mutable prevReturnCommandOpt = ValueNone
let mutable currReturnCommandOpt = ValueNone
let mutable prevReturnCommandCanExecuteOpt = ValueNone
let mutable currReturnCommandCanExecuteOpt = ValueNone
let mutable prevReturnTypeOpt = ValueNone
let mutable currReturnTypeOpt = ValueNone
let mutable prevSelectionLengthOpt = ValueNone
let mutable currSelectionLengthOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
let mutable prevVerticalTextAlignmentOpt = ValueNone
let mutable currVerticalTextAlignmentOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
currCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
currTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ClearButtonVisibilityAttribKey.KeyValue then
currClearButtonVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ClearButtonVisibility)
if kvp.Key = ViewAttributes.CursorPositionAttribKey.KeyValue then
currCursorPositionOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
currHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.IsPasswordAttribKey.KeyValue then
currIsPasswordOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTextPredictionEnabledAttribKey.KeyValue then
currIsTextPredictionEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
currPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
currPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ReturnCommandAttribKey.KeyValue then
currReturnCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.ReturnCommandCanExecuteAttribKey.KeyValue then
currReturnCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ReturnTypeAttribKey.KeyValue then
currReturnTypeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ReturnType)
if kvp.Key = ViewAttributes.SelectionLengthAttribKey.KeyValue then
currSelectionLengthOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
currVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CompletedAttribKey.KeyValue then
prevCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler)
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
prevTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.ClearButtonVisibilityAttribKey.KeyValue then
prevClearButtonVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ClearButtonVisibility)
if kvp.Key = ViewAttributes.CursorPositionAttribKey.KeyValue then
prevCursorPositionOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
prevHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.IsPasswordAttribKey.KeyValue then
prevIsPasswordOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsTextPredictionEnabledAttribKey.KeyValue then
prevIsTextPredictionEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
prevPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
prevPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.ReturnCommandAttribKey.KeyValue then
prevReturnCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.ReturnCommandCanExecuteAttribKey.KeyValue then
prevReturnCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ReturnTypeAttribKey.KeyValue then
prevReturnTypeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ReturnType)
if kvp.Key = ViewAttributes.SelectionLengthAttribKey.KeyValue then
prevSelectionLengthOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
prevVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
// Unsubscribe previous event handlers
let shouldUpdateCompleted = not ((identical prevCompletedOpt currCompletedOpt))
if shouldUpdateCompleted then
match prevCompletedOpt with
| ValueSome prevValue -> target.Completed.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdateTextChanged = not ((identical prevTextChangedOpt currTextChangedOpt) && (identical prevTextOpt currTextOpt))
if shouldUpdateTextChanged then
match prevTextChangedOpt with
| ValueSome prevValue -> target.TextChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateInputView (prevOpt, curr, target)
// Update properties
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
match prevClearButtonVisibilityOpt, currClearButtonVisibilityOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ClearButtonVisibility <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.ClearButtonVisibilityProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateEntryCursorPosition prevCursorPositionOpt currCursorPositionOpt target
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevHorizontalTextAlignmentOpt, currHorizontalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HorizontalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.HorizontalTextAlignmentProperty
| ValueNone, ValueNone -> ()
match prevIsPasswordOpt, currIsPasswordOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsPassword <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.IsPasswordProperty
| ValueNone, ValueNone -> ()
match prevIsTextPredictionEnabledOpt, currIsTextPredictionEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsTextPredictionEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.IsTextPredictionEnabledProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderOpt, currPlaceholderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Placeholder <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.PlaceholderProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderColorOpt, currPlaceholderColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.PlaceholderColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.PlaceholderColorProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevReturnCommandOpt currReturnCommandOpt target
ViewUpdaters.updateCommand prevReturnCommandOpt currReturnCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.Entry) cmd -> target.ReturnCommand <- cmd) prevReturnCommandCanExecuteOpt currReturnCommandCanExecuteOpt target
match prevReturnTypeOpt, currReturnTypeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ReturnType <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.ReturnTypeProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateEntrySelectionLength prevSelectionLengthOpt currSelectionLengthOpt target
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.TextColorProperty
| ValueNone, ValueNone -> ()
match prevVerticalTextAlignmentOpt, currVerticalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.VerticalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.Entry.VerticalTextAlignmentProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCompleted then
match currCompletedOpt with
| ValueSome currValue -> target.Completed.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdateTextChanged then
match currTextChangedOpt with
| ValueSome currValue -> target.TextChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructEntry(?characterSpacing: float,
?clearButtonVisibility: Xamarin.Forms.ClearButtonVisibility,
?cursorPosition: int,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?isPassword: bool,
?isTextPredictionEnabled: bool,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?returnCommand: unit -> unit,
?returnCommandCanExecute: bool,
?returnType: Xamarin.Forms.ReturnType,
?selectionLength: int,
?text: string,
?textColor: Xamarin.Forms.Color,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.Entry>,
?tag: obj,
?completed: string -> unit,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.Entry -> unit)) =
let attribBuilder = ViewBuilders.BuildEntry(0,
?characterSpacing=characterSpacing,
?clearButtonVisibility=clearButtonVisibility,
?cursorPosition=cursorPosition,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?horizontalTextAlignment=horizontalTextAlignment,
?isPassword=isPassword,
?isTextPredictionEnabled=isTextPredictionEnabled,
?placeholder=placeholder,
?placeholderColor=placeholderColor,
?returnCommand=returnCommand,
?returnCommandCanExecute=returnCommandCanExecute,
?returnType=returnType,
?selectionLength=selectionLength,
?text=text,
?textColor=textColor,
?verticalTextAlignment=verticalTextAlignment,
?isReadOnly=isReadOnly,
?isSpellCheckEnabled=isSpellCheckEnabled,
?keyboard=keyboard,
?maxLength=maxLength,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.Entry>) -> Some ref.Unbox),
?tag=tag,
?completed=completed,
?textChanged=textChanged,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.Entry> target))))
ViewElement.Create<Xamarin.Forms.Entry>(ViewBuilders.CreateEntry, (fun prevOpt curr target -> ViewBuilders.UpdateEntry(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a SearchBar in the view
static member inline BuildSearchBar(attribCount: int,
?cancelButtonColor: Xamarin.Forms.Color,
?characterSpacing: float,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?searchCommand: string -> unit,
?searchCommandCanExecute: bool,
?text: string,
?textColor: Xamarin.Forms.Color,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match cancelButtonColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match characterSpacing with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontAttributes with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontFamily with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match fontSize with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match horizontalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholder with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match placeholderColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match searchCommand with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match searchCommandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match text with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textColor with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match verticalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match textChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildInputView(attribCount, ?isReadOnly=isReadOnly, ?isSpellCheckEnabled=isSpellCheckEnabled, ?keyboard=keyboard, ?maxLength=maxLength, ?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?focused=focused, ?unfocused=unfocused, ?created=created)
match cancelButtonColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CancelButtonColorAttribKey, (v))
match characterSpacing with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CharacterSpacingAttribKey, (v))
match fontAttributes with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontAttributesAttribKey, (v))
match fontFamily with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontFamilyAttribKey, (v))
match fontSize with None -> () | Some v -> attribBuilder.Add(ViewAttributes.FontSizeAttribKey, (v))
match horizontalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HorizontalTextAlignmentAttribKey, (v))
match placeholder with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderAttribKey, (v))
match placeholderColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PlaceholderColorAttribKey, (v))
match searchCommand with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SearchCommandAttribKey, (v))
match searchCommandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SearchCommandCanExecuteAttribKey, (v))
match text with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextAttribKey, (v))
match textColor with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextColorAttribKey, (v))
match verticalTextAlignment with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VerticalTextAlignmentAttribKey, (v))
match textChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.TextChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member CreateSearchBar () : Xamarin.Forms.SearchBar =
new Xamarin.Forms.SearchBar()
static member UpdateSearchBar (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.SearchBar) =
let mutable prevTextChangedOpt = ValueNone
let mutable currTextChangedOpt = ValueNone
let mutable prevCancelButtonColorOpt = ValueNone
let mutable currCancelButtonColorOpt = ValueNone
let mutable prevCharacterSpacingOpt = ValueNone
let mutable currCharacterSpacingOpt = ValueNone
let mutable prevFontAttributesOpt = ValueNone
let mutable currFontAttributesOpt = ValueNone
let mutable prevFontFamilyOpt = ValueNone
let mutable currFontFamilyOpt = ValueNone
let mutable prevFontSizeOpt = ValueNone
let mutable currFontSizeOpt = ValueNone
let mutable prevHorizontalTextAlignmentOpt = ValueNone
let mutable currHorizontalTextAlignmentOpt = ValueNone
let mutable prevPlaceholderOpt = ValueNone
let mutable currPlaceholderOpt = ValueNone
let mutable prevPlaceholderColorOpt = ValueNone
let mutable currPlaceholderColorOpt = ValueNone
let mutable prevSearchCommandOpt = ValueNone
let mutable currSearchCommandOpt = ValueNone
let mutable prevSearchCommandCanExecuteOpt = ValueNone
let mutable currSearchCommandCanExecuteOpt = ValueNone
let mutable prevTextOpt = ValueNone
let mutable currTextOpt = ValueNone
let mutable prevTextColorOpt = ValueNone
let mutable currTextColorOpt = ValueNone
let mutable prevVerticalTextAlignmentOpt = ValueNone
let mutable currVerticalTextAlignmentOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
currTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.CancelButtonColorAttribKey.KeyValue then
currCancelButtonColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
currCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
currFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
currFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
currFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
currHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
currPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
currPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.SearchCommandAttribKey.KeyValue then
currSearchCommandOpt <- ValueSome (kvp.Value :?> string -> unit)
if kvp.Key = ViewAttributes.SearchCommandCanExecuteAttribKey.KeyValue then
currSearchCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
currTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
currTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
currVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.TextChangedAttribKey.KeyValue then
prevTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.TextChangedEventArgs>)
if kvp.Key = ViewAttributes.CancelButtonColorAttribKey.KeyValue then
prevCancelButtonColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.CharacterSpacingAttribKey.KeyValue then
prevCharacterSpacingOpt <- ValueSome (kvp.Value :?> float)
if kvp.Key = ViewAttributes.FontAttributesAttribKey.KeyValue then
prevFontAttributesOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.FontAttributes)
if kvp.Key = ViewAttributes.FontFamilyAttribKey.KeyValue then
prevFontFamilyOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.FontSizeAttribKey.KeyValue then
prevFontSizeOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.FontSize)
if kvp.Key = ViewAttributes.HorizontalTextAlignmentAttribKey.KeyValue then
prevHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
if kvp.Key = ViewAttributes.PlaceholderAttribKey.KeyValue then
prevPlaceholderOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.PlaceholderColorAttribKey.KeyValue then
prevPlaceholderColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.SearchCommandAttribKey.KeyValue then
prevSearchCommandOpt <- ValueSome (kvp.Value :?> string -> unit)
if kvp.Key = ViewAttributes.SearchCommandCanExecuteAttribKey.KeyValue then
prevSearchCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.TextAttribKey.KeyValue then
prevTextOpt <- ValueSome (kvp.Value :?> string)
if kvp.Key = ViewAttributes.TextColorAttribKey.KeyValue then
prevTextColorOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Color)
if kvp.Key = ViewAttributes.VerticalTextAlignmentAttribKey.KeyValue then
prevVerticalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment)
// Unsubscribe previous event handlers
let shouldUpdateTextChanged = not ((identical prevTextChangedOpt currTextChangedOpt) && (identical prevTextOpt currTextOpt))
if shouldUpdateTextChanged then
match prevTextChangedOpt with
| ValueSome prevValue -> target.TextChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateInputView (prevOpt, curr, target)
// Update properties
match prevCancelButtonColorOpt, currCancelButtonColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CancelButtonColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.CancelButtonColorProperty
| ValueNone, ValueNone -> ()
match prevCharacterSpacingOpt, currCharacterSpacingOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CharacterSpacing <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.CharacterSpacingProperty
| ValueNone, ValueNone -> ()
match prevFontAttributesOpt, currFontAttributesOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontAttributes <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.FontAttributesProperty
| ValueNone, ValueNone -> ()
match prevFontFamilyOpt, currFontFamilyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontFamily <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.FontFamilyProperty
| ValueNone, ValueNone -> ()
match prevFontSizeOpt, currFontSizeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.FontSize <- ViewConverters.convertFabulousFontSizeToXamarinFormsDouble (target.GetType()) currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.FontSizeProperty
| ValueNone, ValueNone -> ()
match prevHorizontalTextAlignmentOpt, currHorizontalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HorizontalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.HorizontalTextAlignmentProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderOpt, currPlaceholderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Placeholder <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.PlaceholderProperty
| ValueNone, ValueNone -> ()
match prevPlaceholderColorOpt, currPlaceholderColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.PlaceholderColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.PlaceholderColorProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevSearchCommandOpt currSearchCommandOpt target
ViewUpdaters.updateCommand prevSearchCommandOpt currSearchCommandOpt (fun (_target: Xamarin.Forms.SearchBar) -> _target.Text) (fun (target: Xamarin.Forms.SearchBar) cmd -> target.SearchCommand <- cmd) prevSearchCommandCanExecuteOpt currSearchCommandCanExecuteOpt target
match prevTextOpt, currTextOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Text <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.TextProperty
| ValueNone, ValueNone -> ()
match prevTextColorOpt, currTextColorOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.TextColor <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.TextColorProperty
| ValueNone, ValueNone -> ()
match prevVerticalTextAlignmentOpt, currVerticalTextAlignmentOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.VerticalTextAlignment <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SearchBar.VerticalTextAlignmentProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateTextChanged then
match currTextChangedOpt with
| ValueSome currValue -> target.TextChanged.AddHandler(currValue)
| ValueNone -> ()
static member inline ConstructSearchBar(?cancelButtonColor: Xamarin.Forms.Color,
?characterSpacing: float,
?fontAttributes: Xamarin.Forms.FontAttributes,
?fontFamily: string,
?fontSize: Fabulous.XamarinForms.InputTypes.FontSize,
?horizontalTextAlignment: Xamarin.Forms.TextAlignment,
?placeholder: string,
?placeholderColor: Xamarin.Forms.Color,
?searchCommand: string -> unit,
?searchCommandCanExecute: bool,
?text: string,
?textColor: Xamarin.Forms.Color,
?verticalTextAlignment: Xamarin.Forms.TextAlignment,
?isReadOnly: bool,
?isSpellCheckEnabled: bool,
?keyboard: Xamarin.Forms.Keyboard,
?maxLength: int,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Xamarin.Forms.SearchBar>,
?tag: obj,
?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Xamarin.Forms.SearchBar -> unit)) =
let attribBuilder = ViewBuilders.BuildSearchBar(0,
?cancelButtonColor=cancelButtonColor,
?characterSpacing=characterSpacing,
?fontAttributes=fontAttributes,
?fontFamily=fontFamily,
?fontSize=fontSize,
?horizontalTextAlignment=horizontalTextAlignment,
?placeholder=placeholder,
?placeholderColor=placeholderColor,
?searchCommand=searchCommand,
?searchCommandCanExecute=searchCommandCanExecute,
?text=text,
?textColor=textColor,
?verticalTextAlignment=verticalTextAlignment,
?isReadOnly=isReadOnly,
?isSpellCheckEnabled=isSpellCheckEnabled,
?keyboard=keyboard,
?maxLength=maxLength,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Xamarin.Forms.SearchBar>) -> Some ref.Unbox),
?tag=tag,
?textChanged=textChanged,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Xamarin.Forms.SearchBar> target))))
ViewElement.Create<Xamarin.Forms.SearchBar>(ViewBuilders.CreateSearchBar, (fun prevOpt curr target -> ViewBuilders.UpdateSearchBar(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a ItemsView in the view
static member inline BuildItemsView(attribCount: int,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match emptyView with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match horizontalScrollBarVisibility with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match itemSizingStrategy with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match itemsUpdatingScrollMode with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match items with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match remainingItemsThreshold with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match remainingItemsThresholdReachedCommand with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match remainingItemsThresholdReachedCommandCanExecute with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match scrollTo with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match verticalScrollBarVisibility with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match scrolled with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildView(attribCount, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?focused=focused, ?unfocused=unfocused, ?created=created)
match emptyView with None -> () | Some v -> attribBuilder.Add(ViewAttributes.EmptyViewAttribKey, (v))
match horizontalScrollBarVisibility with None -> () | Some v -> attribBuilder.Add(ViewAttributes.HorizontalScrollBarVisibilityAttribKey, (v))
match itemSizingStrategy with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemSizingStrategyAttribKey, (v))
match itemsUpdatingScrollMode with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsUpdatingScrollModeAttribKey, (v))
match items with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsViewItemsSourceAttribKey, Array.ofList(v))
match remainingItemsThreshold with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RemainingItemsThresholdAttribKey, (v))
match remainingItemsThresholdReachedCommand with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RemainingItemsThresholdReachedCommandAttribKey, (v))
match remainingItemsThresholdReachedCommandCanExecute with None -> () | Some v -> attribBuilder.Add(ViewAttributes.RemainingItemsThresholdReachedCommandCanExecuteAttribKey, (v))
match scrollTo with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsViewScrollToAttribKey, (v))
match verticalScrollBarVisibility with None -> () | Some v -> attribBuilder.Add(ViewAttributes.VerticalScrollBarVisibilityAttribKey, (v))
match scrolled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.ItemsViewScrolledAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.ItemsViewScrolledEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member UpdateItemsView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.ItemsView) =
let mutable prevItemsViewScrolledOpt = ValueNone
let mutable currItemsViewScrolledOpt = ValueNone
let mutable prevEmptyViewOpt = ValueNone
let mutable currEmptyViewOpt = ValueNone
let mutable prevHorizontalScrollBarVisibilityOpt = ValueNone
let mutable currHorizontalScrollBarVisibilityOpt = ValueNone
let mutable prevItemSizingStrategyOpt = ValueNone
let mutable currItemSizingStrategyOpt = ValueNone
let mutable prevItemsUpdatingScrollModeOpt = ValueNone
let mutable currItemsUpdatingScrollModeOpt = ValueNone
let mutable prevItemsViewItemsSourceOpt = ValueNone
let mutable currItemsViewItemsSourceOpt = ValueNone
let mutable prevRemainingItemsThresholdOpt = ValueNone
let mutable currRemainingItemsThresholdOpt = ValueNone
let mutable prevRemainingItemsThresholdReachedCommandOpt = ValueNone
let mutable currRemainingItemsThresholdReachedCommandOpt = ValueNone
let mutable prevRemainingItemsThresholdReachedCommandCanExecuteOpt = ValueNone
let mutable currRemainingItemsThresholdReachedCommandCanExecuteOpt = ValueNone
let mutable prevItemsViewScrollToOpt = ValueNone
let mutable currItemsViewScrollToOpt = ValueNone
let mutable prevVerticalScrollBarVisibilityOpt = ValueNone
let mutable currVerticalScrollBarVisibilityOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.ItemsViewScrolledAttribKey.KeyValue then
currItemsViewScrolledOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ItemsViewScrolledEventArgs>)
if kvp.Key = ViewAttributes.EmptyViewAttribKey.KeyValue then
currEmptyViewOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.HorizontalScrollBarVisibilityAttribKey.KeyValue then
currHorizontalScrollBarVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ScrollBarVisibility)
if kvp.Key = ViewAttributes.ItemSizingStrategyAttribKey.KeyValue then
currItemSizingStrategyOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ItemSizingStrategy)
if kvp.Key = ViewAttributes.ItemsUpdatingScrollModeAttribKey.KeyValue then
currItemsUpdatingScrollModeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ItemsUpdatingScrollMode)
if kvp.Key = ViewAttributes.ItemsViewItemsSourceAttribKey.KeyValue then
currItemsViewItemsSourceOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.RemainingItemsThresholdAttribKey.KeyValue then
currRemainingItemsThresholdOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.RemainingItemsThresholdReachedCommandAttribKey.KeyValue then
currRemainingItemsThresholdReachedCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.RemainingItemsThresholdReachedCommandCanExecuteAttribKey.KeyValue then
currRemainingItemsThresholdReachedCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ItemsViewScrollToAttribKey.KeyValue then
currItemsViewScrollToOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.ScrollToItem)
if kvp.Key = ViewAttributes.VerticalScrollBarVisibilityAttribKey.KeyValue then
currVerticalScrollBarVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ScrollBarVisibility)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.ItemsViewScrolledAttribKey.KeyValue then
prevItemsViewScrolledOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.ItemsViewScrolledEventArgs>)
if kvp.Key = ViewAttributes.EmptyViewAttribKey.KeyValue then
prevEmptyViewOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.HorizontalScrollBarVisibilityAttribKey.KeyValue then
prevHorizontalScrollBarVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ScrollBarVisibility)
if kvp.Key = ViewAttributes.ItemSizingStrategyAttribKey.KeyValue then
prevItemSizingStrategyOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ItemSizingStrategy)
if kvp.Key = ViewAttributes.ItemsUpdatingScrollModeAttribKey.KeyValue then
prevItemsUpdatingScrollModeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ItemsUpdatingScrollMode)
if kvp.Key = ViewAttributes.ItemsViewItemsSourceAttribKey.KeyValue then
prevItemsViewItemsSourceOpt <- ValueSome (kvp.Value :?> ViewElement array)
if kvp.Key = ViewAttributes.RemainingItemsThresholdAttribKey.KeyValue then
prevRemainingItemsThresholdOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.RemainingItemsThresholdReachedCommandAttribKey.KeyValue then
prevRemainingItemsThresholdReachedCommandOpt <- ValueSome (kvp.Value :?> unit -> unit)
if kvp.Key = ViewAttributes.RemainingItemsThresholdReachedCommandCanExecuteAttribKey.KeyValue then
prevRemainingItemsThresholdReachedCommandCanExecuteOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.ItemsViewScrollToAttribKey.KeyValue then
prevItemsViewScrollToOpt <- ValueSome (kvp.Value :?> Fabulous.XamarinForms.InputTypes.ScrollToItem)
if kvp.Key = ViewAttributes.VerticalScrollBarVisibilityAttribKey.KeyValue then
prevVerticalScrollBarVisibilityOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.ScrollBarVisibility)
// Unsubscribe previous event handlers
let shouldUpdateItemsViewScrolled = not ((identical prevItemsViewScrolledOpt currItemsViewScrolledOpt))
if shouldUpdateItemsViewScrolled then
match prevItemsViewScrolledOpt with
| ValueSome prevValue -> target.Scrolled.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateView (prevOpt, curr, target)
// Update properties
match prevEmptyViewOpt, currEmptyViewOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.EmptyView)
| _, ValueSome newValue ->
target.EmptyView <- (newValue.Create() :?> obj)
| ValueSome _, ValueNone ->
target.EmptyView <- null
| ValueNone, ValueNone -> ()
match prevHorizontalScrollBarVisibilityOpt, currHorizontalScrollBarVisibilityOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.HorizontalScrollBarVisibility <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ItemsView.HorizontalScrollBarVisibilityProperty
| ValueNone, ValueNone -> ()
match prevItemSizingStrategyOpt, currItemSizingStrategyOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ItemSizingStrategy <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ItemsView.ItemSizingStrategyProperty
| ValueNone, ValueNone -> ()
match prevItemsUpdatingScrollModeOpt, currItemsUpdatingScrollModeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ItemsUpdatingScrollMode <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ItemsView.ItemsUpdatingScrollModeProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateItemsViewItems prevItemsViewItemsSourceOpt currItemsViewItemsSourceOpt target
match prevRemainingItemsThresholdOpt, currRemainingItemsThresholdOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.RemainingItemsThreshold <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ItemsView.RemainingItemsThresholdProperty
| ValueNone, ValueNone -> ()
(fun _ _ _ -> ()) prevRemainingItemsThresholdReachedCommandOpt currRemainingItemsThresholdReachedCommandOpt target
ViewUpdaters.updateCommand prevRemainingItemsThresholdReachedCommandOpt currRemainingItemsThresholdReachedCommandOpt (fun _target -> ()) (fun (target: Xamarin.Forms.ItemsView) cmd -> target.RemainingItemsThresholdReachedCommand <- cmd) prevRemainingItemsThresholdReachedCommandCanExecuteOpt currRemainingItemsThresholdReachedCommandCanExecuteOpt target
ViewUpdaters.triggerItemsViewScrollTo prevItemsViewScrollToOpt currItemsViewScrollToOpt target
match prevVerticalScrollBarVisibilityOpt, currVerticalScrollBarVisibilityOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.VerticalScrollBarVisibility <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.ItemsView.VerticalScrollBarVisibilityProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateItemsViewScrolled then
match currItemsViewScrolledOpt with
| ValueSome currValue -> target.Scrolled.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a StructuredItemsView in the view
static member inline BuildStructuredItemsView(attribCount: int,
?footer: obj,
?header: obj,
?itemsLayout: Xamarin.Forms.IItemsLayout,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match footer with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match header with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match itemsLayout with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildItemsView(attribCount, ?emptyView=emptyView, ?horizontalScrollBarVisibility=horizontalScrollBarVisibility, ?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode, ?items=items,
?remainingItemsThreshold=remainingItemsThreshold, ?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand, ?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo, ?verticalScrollBarVisibility=verticalScrollBarVisibility,
?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?scrolled=scrolled, ?focused=focused, ?unfocused=unfocused, ?created=created)
match footer with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StructuredItemsViewFooterAttribKey, (v))
match header with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StructuredItemsViewHeaderAttribKey, (v))
match itemsLayout with None -> () | Some v -> attribBuilder.Add(ViewAttributes.StructuredItemsViewItemsLayoutAttribKey, (v))
attribBuilder
static member UpdateStructuredItemsView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.StructuredItemsView) =
let mutable prevStructuredItemsViewFooterOpt = ValueNone
let mutable currStructuredItemsViewFooterOpt = ValueNone
let mutable prevStructuredItemsViewHeaderOpt = ValueNone
let mutable currStructuredItemsViewHeaderOpt = ValueNone
let mutable prevStructuredItemsViewItemsLayoutOpt = ValueNone
let mutable currStructuredItemsViewItemsLayoutOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.StructuredItemsViewFooterAttribKey.KeyValue then
currStructuredItemsViewFooterOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.StructuredItemsViewHeaderAttribKey.KeyValue then
currStructuredItemsViewHeaderOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.StructuredItemsViewItemsLayoutAttribKey.KeyValue then
currStructuredItemsViewItemsLayoutOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.IItemsLayout)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.StructuredItemsViewFooterAttribKey.KeyValue then
prevStructuredItemsViewFooterOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.StructuredItemsViewHeaderAttribKey.KeyValue then
prevStructuredItemsViewHeaderOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.StructuredItemsViewItemsLayoutAttribKey.KeyValue then
prevStructuredItemsViewItemsLayoutOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.IItemsLayout)
// Update inherited members
ViewBuilders.UpdateItemsView (prevOpt, curr, target)
// Update properties
match prevStructuredItemsViewFooterOpt, currStructuredItemsViewFooterOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Footer <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.StructuredItemsView.FooterProperty
| ValueNone, ValueNone -> ()
match prevStructuredItemsViewHeaderOpt, currStructuredItemsViewHeaderOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Header <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.StructuredItemsView.HeaderProperty
| ValueNone, ValueNone -> ()
match prevStructuredItemsViewItemsLayoutOpt, currStructuredItemsViewItemsLayoutOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.ItemsLayout <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.StructuredItemsView.ItemsLayoutProperty
| ValueNone, ValueNone -> ()
/// Builds the attributes for a XFCarouselView in the view
static member inline BuildXFCarouselView(attribCount: int,
?currentItem: obj,
?isBounceEnabled: bool,
?isScrollAnimated: bool,
?isSwipeEnabled: bool,
?itemsLayout: ViewElement,
?numberOfSideItems: int,
?peekAreaInsets: Xamarin.Forms.Thickness,
?position: int,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?currentItemChanged: Xamarin.Forms.CurrentItemChangedEventArgs -> unit,
?positionChanged: Xamarin.Forms.PositionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match currentItem with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isBounceEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isScrollAnimated with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isSwipeEnabled with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match itemsLayout with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match numberOfSideItems with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match peekAreaInsets with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match position with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match currentItemChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match positionChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildItemsView(attribCount, ?emptyView=emptyView, ?horizontalScrollBarVisibility=horizontalScrollBarVisibility, ?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode, ?items=items,
?remainingItemsThreshold=remainingItemsThreshold, ?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand, ?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo, ?verticalScrollBarVisibility=verticalScrollBarVisibility,
?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX,
?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height,
?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX,
?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles,
?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual,
?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId,
?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref,
?tag=tag, ?scrolled=scrolled, ?focused=focused, ?unfocused=unfocused, ?created=created)
match currentItem with None -> () | Some v -> attribBuilder.Add(ViewAttributes.XFCarouselViewCurrentItemAttribKey, (v))
match isBounceEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsBounceEnabledAttribKey, (v))
match isScrollAnimated with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsScrollAnimatedAttribKey, (v))
match isSwipeEnabled with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsSwipeEnabledAttribKey, (v))
match itemsLayout with None -> () | Some v -> attribBuilder.Add(ViewAttributes.XFCarouselViewItemsLayoutAttribKey, (v))
match numberOfSideItems with None -> () | Some v -> attribBuilder.Add(ViewAttributes.NumberOfSideItemsAttribKey, (v))
match peekAreaInsets with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PeekAreaInsetsAttribKey, (v))
match position with None -> () | Some v -> attribBuilder.Add(ViewAttributes.XFCarouselViewPositionAttribKey, (v))
match currentItemChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.CurrentItemChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.CurrentItemChangedEventArgs>(fun _sender _args -> f _args))(v))
match positionChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.PositionChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.PositionChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member UpdateXFCarouselView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.CarouselView) =
let mutable prevCurrentItemChangedOpt = ValueNone
let mutable currCurrentItemChangedOpt = ValueNone
let mutable prevPositionChangedOpt = ValueNone
let mutable currPositionChangedOpt = ValueNone
let mutable prevXFCarouselViewCurrentItemOpt = ValueNone
let mutable currXFCarouselViewCurrentItemOpt = ValueNone
let mutable prevIsBounceEnabledOpt = ValueNone
let mutable currIsBounceEnabledOpt = ValueNone
let mutable prevIsScrollAnimatedOpt = ValueNone
let mutable currIsScrollAnimatedOpt = ValueNone
let mutable prevIsSwipeEnabledOpt = ValueNone
let mutable currIsSwipeEnabledOpt = ValueNone
let mutable prevXFCarouselViewItemsLayoutOpt = ValueNone
let mutable currXFCarouselViewItemsLayoutOpt = ValueNone
let mutable prevNumberOfSideItemsOpt = ValueNone
let mutable currNumberOfSideItemsOpt = ValueNone
let mutable prevPeekAreaInsetsOpt = ValueNone
let mutable currPeekAreaInsetsOpt = ValueNone
let mutable prevXFCarouselViewPositionOpt = ValueNone
let mutable currXFCarouselViewPositionOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentItemChangedAttribKey.KeyValue then
currCurrentItemChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.CurrentItemChangedEventArgs>)
if kvp.Key = ViewAttributes.PositionChangedAttribKey.KeyValue then
currPositionChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PositionChangedEventArgs>)
if kvp.Key = ViewAttributes.XFCarouselViewCurrentItemAttribKey.KeyValue then
currXFCarouselViewCurrentItemOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.IsBounceEnabledAttribKey.KeyValue then
currIsBounceEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsScrollAnimatedAttribKey.KeyValue then
currIsScrollAnimatedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsSwipeEnabledAttribKey.KeyValue then
currIsSwipeEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.XFCarouselViewItemsLayoutAttribKey.KeyValue then
currXFCarouselViewItemsLayoutOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.NumberOfSideItemsAttribKey.KeyValue then
currNumberOfSideItemsOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.PeekAreaInsetsAttribKey.KeyValue then
currPeekAreaInsetsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.XFCarouselViewPositionAttribKey.KeyValue then
currXFCarouselViewPositionOpt <- ValueSome (kvp.Value :?> int)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.CurrentItemChangedAttribKey.KeyValue then
prevCurrentItemChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.CurrentItemChangedEventArgs>)
if kvp.Key = ViewAttributes.PositionChangedAttribKey.KeyValue then
prevPositionChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.PositionChangedEventArgs>)
if kvp.Key = ViewAttributes.XFCarouselViewCurrentItemAttribKey.KeyValue then
prevXFCarouselViewCurrentItemOpt <- ValueSome (kvp.Value :?> obj)
if kvp.Key = ViewAttributes.IsBounceEnabledAttribKey.KeyValue then
prevIsBounceEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsScrollAnimatedAttribKey.KeyValue then
prevIsScrollAnimatedOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.IsSwipeEnabledAttribKey.KeyValue then
prevIsSwipeEnabledOpt <- ValueSome (kvp.Value :?> bool)
if kvp.Key = ViewAttributes.XFCarouselViewItemsLayoutAttribKey.KeyValue then
prevXFCarouselViewItemsLayoutOpt <- ValueSome (kvp.Value :?> ViewElement)
if kvp.Key = ViewAttributes.NumberOfSideItemsAttribKey.KeyValue then
prevNumberOfSideItemsOpt <- ValueSome (kvp.Value :?> int)
if kvp.Key = ViewAttributes.PeekAreaInsetsAttribKey.KeyValue then
prevPeekAreaInsetsOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.Thickness)
if kvp.Key = ViewAttributes.XFCarouselViewPositionAttribKey.KeyValue then
prevXFCarouselViewPositionOpt <- ValueSome (kvp.Value :?> int)
// Unsubscribe previous event handlers
let shouldUpdateCurrentItemChanged = not ((identical prevCurrentItemChangedOpt currCurrentItemChangedOpt) && (identical prevXFCarouselViewCurrentItemOpt currXFCarouselViewCurrentItemOpt))
if shouldUpdateCurrentItemChanged then
match prevCurrentItemChangedOpt with
| ValueSome prevValue -> target.CurrentItemChanged.RemoveHandler(prevValue)
| ValueNone -> ()
let shouldUpdatePositionChanged = not ((identical prevPositionChangedOpt currPositionChangedOpt) && (identical prevXFCarouselViewPositionOpt currXFCarouselViewPositionOpt))
if shouldUpdatePositionChanged then
match prevPositionChangedOpt with
| ValueSome prevValue -> target.PositionChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateItemsView (prevOpt, curr, target)
// Update properties
match prevXFCarouselViewCurrentItemOpt, currXFCarouselViewCurrentItemOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.CurrentItem <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.CurrentItemProperty
| ValueNone, ValueNone -> ()
match prevIsBounceEnabledOpt, currIsBounceEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsBounceEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.IsBounceEnabledProperty
| ValueNone, ValueNone -> ()
match prevIsScrollAnimatedOpt, currIsScrollAnimatedOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsScrollAnimated <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.IsScrollAnimatedProperty
| ValueNone, ValueNone -> ()
match prevIsSwipeEnabledOpt, currIsSwipeEnabledOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsSwipeEnabled <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.IsSwipeEnabledProperty
| ValueNone, ValueNone -> ()
match prevXFCarouselViewItemsLayoutOpt, currXFCarouselViewItemsLayoutOpt with
// For structured objects, dependsOn on reference equality
| ValueSome prevValue, ValueSome newValue when identical prevValue newValue -> ()
| ValueSome prevValue, ValueSome newValue when canReuseView prevValue newValue ->
newValue.UpdateIncremental(prevValue, target.ItemsLayout)
| _, ValueSome newValue ->
target.ItemsLayout <- (newValue.Create() :?> Xamarin.Forms.LinearItemsLayout)
| ValueSome _, ValueNone ->
target.ItemsLayout <- null
| ValueNone, ValueNone -> ()
match prevNumberOfSideItemsOpt, currNumberOfSideItemsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.NumberOfSideItems <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.NumberOfSideItemsProperty
| ValueNone, ValueNone -> ()
match prevPeekAreaInsetsOpt, currPeekAreaInsetsOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.PeekAreaInsets <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.PeekAreaInsetsProperty
| ValueNone, ValueNone -> ()
match prevXFCarouselViewPositionOpt, currXFCarouselViewPositionOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.Position <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.CarouselView.PositionProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateCurrentItemChanged then
match currCurrentItemChangedOpt with
| ValueSome currValue -> target.CurrentItemChanged.AddHandler(currValue)
| ValueNone -> ()
if shouldUpdatePositionChanged then
match currPositionChangedOpt with
| ValueSome currValue -> target.PositionChanged.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a CarouselView in the view
static member inline BuildCarouselView(attribCount: int,
?currentItem: obj,
?isBounceEnabled: bool,
?isScrollAnimated: bool,
?isSwipeEnabled: bool,
?itemsLayout: ViewElement,
?numberOfSideItems: int,
?peekAreaInsets: Xamarin.Forms.Thickness,
?position: int,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?currentItemChanged: Xamarin.Forms.CurrentItemChangedEventArgs -> unit,
?positionChanged: Xamarin.Forms.PositionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildXFCarouselView(attribCount, ?currentItem=currentItem, ?isBounceEnabled=isBounceEnabled, ?isScrollAnimated=isScrollAnimated, ?isSwipeEnabled=isSwipeEnabled, ?itemsLayout=itemsLayout,
?numberOfSideItems=numberOfSideItems, ?peekAreaInsets=peekAreaInsets, ?position=position, ?emptyView=emptyView, ?horizontalScrollBarVisibility=horizontalScrollBarVisibility,
?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode, ?items=items, ?remainingItemsThreshold=remainingItemsThreshold, ?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand,
?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo, ?verticalScrollBarVisibility=verticalScrollBarVisibility, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions,
?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY, ?backgroundColor=backgroundColor,
?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent, ?isEnabled=isEnabled,
?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth, ?opacity=opacity,
?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY, ?scale=scale,
?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets, ?tabIndex=tabIndex,
?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width, ?style=style,
?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId, ?effects=effects,
?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag, ?currentItemChanged=currentItemChanged,
?positionChanged=positionChanged, ?scrolled=scrolled, ?focused=focused, ?unfocused=unfocused, ?created=created)
attribBuilder
static member CreateCarouselView () : Fabulous.XamarinForms.CustomCarouselView =
new Fabulous.XamarinForms.CustomCarouselView()
static member UpdateCarouselView (prevOpt: ViewElement voption, curr: ViewElement, target: Fabulous.XamarinForms.CustomCarouselView) =
ViewBuilders.UpdateXFCarouselView (prevOpt, curr, target)
static member inline ConstructCarouselView(?currentItem: obj,
?isBounceEnabled: bool,
?isScrollAnimated: bool,
?isSwipeEnabled: bool,
?itemsLayout: ViewElement,
?numberOfSideItems: int,
?peekAreaInsets: Xamarin.Forms.Thickness,
?position: int,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef<Fabulous.XamarinForms.CustomCarouselView>,
?tag: obj,
?currentItemChanged: Xamarin.Forms.CurrentItemChangedEventArgs -> unit,
?positionChanged: Xamarin.Forms.PositionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: (Fabulous.XamarinForms.CustomCarouselView -> unit)) =
let attribBuilder = ViewBuilders.BuildCarouselView(0,
?currentItem=currentItem,
?isBounceEnabled=isBounceEnabled,
?isScrollAnimated=isScrollAnimated,
?isSwipeEnabled=isSwipeEnabled,
?itemsLayout=itemsLayout,
?numberOfSideItems=numberOfSideItems,
?peekAreaInsets=peekAreaInsets,
?position=position,
?emptyView=emptyView,
?horizontalScrollBarVisibility=horizontalScrollBarVisibility,
?itemSizingStrategy=itemSizingStrategy,
?itemsUpdatingScrollMode=itemsUpdatingScrollMode,
?items=items,
?remainingItemsThreshold=remainingItemsThreshold,
?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand,
?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute,
?scrollTo=scrollTo,
?verticalScrollBarVisibility=verticalScrollBarVisibility,
?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions,
?margin=margin,
?verticalOptions=verticalOptions,
?anchorX=anchorX,
?anchorY=anchorY,
?backgroundColor=backgroundColor,
?behaviors=behaviors,
?flowDirection=flowDirection,
?height=height,
?inputTransparent=inputTransparent,
?isEnabled=isEnabled,
?isTabStop=isTabStop,
?isVisible=isVisible,
?minimumHeight=minimumHeight,
?minimumWidth=minimumWidth,
?opacity=opacity,
?resources=resources,
?rotation=rotation,
?rotationX=rotationX,
?rotationY=rotationY,
?scale=scale,
?scaleX=scaleX,
?scaleY=scaleY,
?styles=styles,
?styleSheets=styleSheets,
?tabIndex=tabIndex,
?translationX=translationX,
?translationY=translationY,
?visual=visual,
?width=width,
?style=style,
?styleClasses=styleClasses,
?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor,
?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior,
?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler,
?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor,
?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor,
?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView,
?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId,
?classId=classId,
?effects=effects,
?menu=menu,
?styleId=styleId,
?ref=(match ref with None -> None | Some (ref: ViewRef<Fabulous.XamarinForms.CustomCarouselView>) -> Some ref.Unbox),
?tag=tag,
?currentItemChanged=currentItemChanged,
?positionChanged=positionChanged,
?scrolled=scrolled,
?focused=focused,
?unfocused=unfocused,
?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox<Fabulous.XamarinForms.CustomCarouselView> target))))
ViewElement.Create<Fabulous.XamarinForms.CustomCarouselView>(ViewBuilders.CreateCarouselView, (fun prevOpt curr target -> ViewBuilders.UpdateCarouselView(prevOpt, curr, target)), attribBuilder)
/// Builds the attributes for a SelectableItemsView in the view
static member inline BuildSelectableItemsView(attribCount: int,
?selectedItem: int option,
?selectedItems: int list option,
?selectionMode: Xamarin.Forms.SelectionMode,
?footer: obj,
?header: obj,
?itemsLayout: Xamarin.Forms.IItemsLayout,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?selectionChanged: Xamarin.Forms.SelectionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match selectedItem with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match selectedItems with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match selectionMode with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match selectionChanged with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildStructuredItemsView(attribCount, ?footer=footer, ?header=header, ?itemsLayout=itemsLayout, ?emptyView=emptyView, ?horizontalScrollBarVisibility=horizontalScrollBarVisibility,
?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode, ?items=items, ?remainingItemsThreshold=remainingItemsThreshold, ?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand,
?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo, ?verticalScrollBarVisibility=verticalScrollBarVisibility, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions,
?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY, ?backgroundColor=backgroundColor,
?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent, ?isEnabled=isEnabled,
?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth, ?opacity=opacity,
?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY, ?scale=scale,
?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets, ?tabIndex=tabIndex,
?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width, ?style=style,
?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor,
?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor,
?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor,
?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId, ?effects=effects,
?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag, ?scrolled=scrolled,
?focused=focused, ?unfocused=unfocused, ?created=created)
match selectedItem with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectedItemAttribKey, (v))
match selectedItems with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectedItemsAttribKey, (Option.map Array.ofList)(v))
match selectionMode with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectableItemsViewSelectionModeAttribKey, (v))
match selectionChanged with None -> () | Some v -> attribBuilder.Add(ViewAttributes.SelectionChangedAttribKey, (fun f -> System.EventHandler<Xamarin.Forms.SelectionChangedEventArgs>(fun _sender _args -> f _args))(v))
attribBuilder
static member UpdateSelectableItemsView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.SelectableItemsView) =
let mutable prevSelectionChangedOpt = ValueNone
let mutable currSelectionChangedOpt = ValueNone
let mutable prevSelectedItemOpt = ValueNone
let mutable currSelectedItemOpt = ValueNone
let mutable prevSelectedItemsOpt = ValueNone
let mutable currSelectedItemsOpt = ValueNone
let mutable prevSelectableItemsViewSelectionModeOpt = ValueNone
let mutable currSelectableItemsViewSelectionModeOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.SelectionChangedAttribKey.KeyValue then
currSelectionChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.SelectionChangedEventArgs>)
if kvp.Key = ViewAttributes.SelectedItemAttribKey.KeyValue then
currSelectedItemOpt <- ValueSome (kvp.Value :?> int option)
if kvp.Key = ViewAttributes.SelectedItemsAttribKey.KeyValue then
currSelectedItemsOpt <- ValueSome (kvp.Value :?> int array option)
if kvp.Key = ViewAttributes.SelectableItemsViewSelectionModeAttribKey.KeyValue then
currSelectableItemsViewSelectionModeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.SelectionMode)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.SelectionChangedAttribKey.KeyValue then
prevSelectionChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler<Xamarin.Forms.SelectionChangedEventArgs>)
if kvp.Key = ViewAttributes.SelectedItemAttribKey.KeyValue then
prevSelectedItemOpt <- ValueSome (kvp.Value :?> int option)
if kvp.Key = ViewAttributes.SelectedItemsAttribKey.KeyValue then
prevSelectedItemsOpt <- ValueSome (kvp.Value :?> int array option)
if kvp.Key = ViewAttributes.SelectableItemsViewSelectionModeAttribKey.KeyValue then
prevSelectableItemsViewSelectionModeOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.SelectionMode)
// Unsubscribe previous event handlers
let shouldUpdateSelectionChanged = not ((identical prevSelectionChangedOpt currSelectionChangedOpt) && (identical prevSelectedItemOpt currSelectedItemOpt) && (identical prevSelectedItemsOpt currSelectedItemsOpt))
if shouldUpdateSelectionChanged then
match prevSelectionChangedOpt with
| ValueSome prevValue -> target.SelectionChanged.RemoveHandler(prevValue)
| ValueNone -> ()
// Update inherited members
ViewBuilders.UpdateStructuredItemsView (prevOpt, curr, target)
// Update properties
match prevSelectedItemOpt, currSelectedItemOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.SelectedItem <- ViewConverters.convertItemsViewSelectedItemIndexToObj target currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SelectableItemsView.SelectedItemProperty
| ValueNone, ValueNone -> ()
ViewUpdaters.updateSelectableItemsViewSelectedItems prevSelectedItemsOpt currSelectedItemsOpt target
match prevSelectableItemsViewSelectionModeOpt, currSelectableItemsViewSelectionModeOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.SelectionMode <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.SelectableItemsView.SelectionModeProperty
| ValueNone, ValueNone -> ()
// Subscribe new event handlers
if shouldUpdateSelectionChanged then
match currSelectionChangedOpt with
| ValueSome currValue -> target.SelectionChanged.AddHandler(currValue)
| ValueNone -> ()
/// Builds the attributes for a GroupableItemsView in the view
static member inline BuildGroupableItemsView(attribCount: int,
?groupFooterTemplate: Xamarin.Forms.DataTemplate,
?groupHeaderTemplate: Xamarin.Forms.DataTemplate,
?isGrouped: bool,
?selectedItem: int option,
?selectedItems: int list option,
?selectionMode: Xamarin.Forms.SelectionMode,
?footer: obj,
?header: obj,
?itemsLayout: Xamarin.Forms.IItemsLayout,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?selectionChanged: Xamarin.Forms.SelectionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribCount = match groupFooterTemplate with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match groupHeaderTemplate with Some _ -> attribCount + 1 | None -> attribCount
let attribCount = match isGrouped with Some _ -> attribCount + 1 | None -> attribCount
let attribBuilder = ViewBuilders.BuildSelectableItemsView(attribCount, ?selectedItem=selectedItem, ?selectedItems=selectedItems, ?selectionMode=selectionMode, ?footer=footer, ?header=header,
?itemsLayout=itemsLayout, ?emptyView=emptyView, ?horizontalScrollBarVisibility=horizontalScrollBarVisibility, ?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode,
?items=items, ?remainingItemsThreshold=remainingItemsThreshold, ?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand, ?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo,
?verticalScrollBarVisibility=verticalScrollBarVisibility, ?gestureRecognizers=gestureRecognizers, ?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions,
?anchorX=anchorX, ?anchorY=anchorY, ?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection,
?height=height, ?inputTransparent=inputTransparent, ?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible,
?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth, ?opacity=opacity, ?resources=resources, ?rotation=rotation,
?rotationX=rotationX, ?rotationY=rotationY, ?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY,
?styles=styles, ?styleSheets=styleSheets, ?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY,
?visual=visual, ?width=width, ?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior,
?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor, ?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible,
?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor, ?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible,
?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor, ?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor,
?automationId=automationId, ?classId=classId, ?effects=effects, ?menu=menu, ?styleId=styleId,
?ref=ref, ?tag=tag, ?selectionChanged=selectionChanged, ?scrolled=scrolled, ?focused=focused,
?unfocused=unfocused, ?created=created)
match groupFooterTemplate with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GroupFooterTemplateAttribKey, (v))
match groupHeaderTemplate with None -> () | Some v -> attribBuilder.Add(ViewAttributes.GroupHeaderTemplateAttribKey, (v))
match isGrouped with None -> () | Some v -> attribBuilder.Add(ViewAttributes.IsGroupedAttribKey, (v))
attribBuilder
static member UpdateGroupableItemsView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.GroupableItemsView) =
let mutable prevGroupFooterTemplateOpt = ValueNone
let mutable currGroupFooterTemplateOpt = ValueNone
let mutable prevGroupHeaderTemplateOpt = ValueNone
let mutable currGroupHeaderTemplateOpt = ValueNone
let mutable prevIsGroupedOpt = ValueNone
let mutable currIsGroupedOpt = ValueNone
for kvp in curr.AttributesKeyed do
if kvp.Key = ViewAttributes.GroupFooterTemplateAttribKey.KeyValue then
currGroupFooterTemplateOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.DataTemplate)
if kvp.Key = ViewAttributes.GroupHeaderTemplateAttribKey.KeyValue then
currGroupHeaderTemplateOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.DataTemplate)
if kvp.Key = ViewAttributes.IsGroupedAttribKey.KeyValue then
currIsGroupedOpt <- ValueSome (kvp.Value :?> bool)
match prevOpt with
| ValueNone -> ()
| ValueSome prev ->
for kvp in prev.AttributesKeyed do
if kvp.Key = ViewAttributes.GroupFooterTemplateAttribKey.KeyValue then
prevGroupFooterTemplateOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.DataTemplate)
if kvp.Key = ViewAttributes.GroupHeaderTemplateAttribKey.KeyValue then
prevGroupHeaderTemplateOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.DataTemplate)
if kvp.Key = ViewAttributes.IsGroupedAttribKey.KeyValue then
prevIsGroupedOpt <- ValueSome (kvp.Value :?> bool)
// Update inherited members
ViewBuilders.UpdateSelectableItemsView (prevOpt, curr, target)
// Update properties
match prevGroupFooterTemplateOpt, currGroupFooterTemplateOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.GroupFooterTemplate <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.GroupableItemsView.GroupFooterTemplateProperty
| ValueNone, ValueNone -> ()
match prevGroupHeaderTemplateOpt, currGroupHeaderTemplateOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.GroupHeaderTemplate <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.GroupableItemsView.GroupHeaderTemplateProperty
| ValueNone, ValueNone -> ()
match prevIsGroupedOpt, currIsGroupedOpt with
| ValueSome prevValue, ValueSome currValue when prevValue = currValue -> ()
| _, ValueSome currValue -> target.IsGrouped <- currValue
| ValueSome _, ValueNone -> target.ClearValue Xamarin.Forms.GroupableItemsView.IsGroupedProperty
| ValueNone, ValueNone -> ()
/// Builds the attributes for a CollectionView in the view
static member inline BuildCollectionView(attribCount: int,
?groupFooterTemplate: Xamarin.Forms.DataTemplate,
?groupHeaderTemplate: Xamarin.Forms.DataTemplate,
?isGrouped: bool,
?selectedItem: int option,
?selectedItems: int list option,
?selectionMode: Xamarin.Forms.SelectionMode,
?footer: obj,
?header: obj,
?itemsLayout: Xamarin.Forms.IItemsLayout,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?remainingItemsThresholdReachedCommandCanExecute: bool,
?scrollTo: Fabulous.XamarinForms.InputTypes.ScrollToItem,
?verticalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?gestureRecognizers: ViewElement list,
?horizontalOptions: Xamarin.Forms.LayoutOptions,
?margin: Xamarin.Forms.Thickness,
?verticalOptions: Xamarin.Forms.LayoutOptions,
?anchorX: float,
?anchorY: float,
?backgroundColor: Xamarin.Forms.Color,
?behaviors: ViewElement list,
?flowDirection: Xamarin.Forms.FlowDirection,
?height: float,
?inputTransparent: bool,
?isEnabled: bool,
?isTabStop: bool,
?isVisible: bool,
?minimumHeight: float,
?minimumWidth: float,
?opacity: float,
?resources: (string * obj) list,
?rotation: float,
?rotationX: float,
?rotationY: float,
?scale: float,
?scaleX: float,
?scaleY: float,
?styles: Xamarin.Forms.Style list,
?styleSheets: Xamarin.Forms.StyleSheets.StyleSheet list,
?tabIndex: int,
?translationX: float,
?translationY: float,
?visual: Xamarin.Forms.IVisual,
?width: float,
?style: Xamarin.Forms.Style,
?styleClasses: string list,
?shellBackButtonBehavior: ViewElement,
?shellBackgroundColor: Xamarin.Forms.Color,
?shellDisabledColor: Xamarin.Forms.Color,
?shellForegroundColor: Xamarin.Forms.Color,
?shellFlyoutBehavior: Xamarin.Forms.FlyoutBehavior,
?shellNavBarIsVisible: bool,
?shellSearchHandler: ViewElement,
?shellTabBarBackgroundColor: Xamarin.Forms.Color,
?shellTabBarDisabledColor: Xamarin.Forms.Color,
?shellTabBarForegroundColor: Xamarin.Forms.Color,
?shellTabBarIsVisible: bool,
?shellTabBarTitleColor: Xamarin.Forms.Color,
?shellTabBarUnselectedColor: Xamarin.Forms.Color,
?shellTitleColor: Xamarin.Forms.Color,
?shellTitleView: ViewElement,
?shellUnselectedColor: Xamarin.Forms.Color,
?automationId: string,
?classId: string,
?effects: ViewElement list,
?menu: ViewElement,
?styleId: string,
?ref: ViewRef,
?tag: obj,
?selectionChanged: Xamarin.Forms.SelectionChangedEventArgs -> unit,
?scrolled: Xamarin.Forms.ItemsViewScrolledEventArgs -> unit,
?focused: Xamarin.Forms.FocusEventArgs -> unit,
?unfocused: Xamarin.Forms.FocusEventArgs -> unit,
?created: obj -> unit) =
let attribBuilder = ViewBuilders.BuildGroupableItemsView(attribCount, ?groupFooterTemplate=groupFooterTemplate, ?groupHeaderTemplate=groupHeaderTemplate, ?isGrouped=isGrouped, ?selectedItem=selectedItem, ?selectedItems=selectedItems,
?selectionMode=selectionMode, ?footer=footer, ?header=header, ?itemsLayout=itemsLayout, ?emptyView=emptyView,
?horizontalScrollBarVisibility=horizontalScrollBarVisibility, ?itemSizingStrategy=itemSizingStrategy, ?itemsUpdatingScrollMode=itemsUpdatingScrollMode, ?items=items, ?remainingItemsThreshold=remainingItemsThreshold,
?remainingItemsThresholdReachedCommand=remainingItemsThresholdReachedCommand, ?remainingItemsThresholdReachedCommandCanExecute=remainingItemsThresholdReachedCommandCanExecute, ?scrollTo=scrollTo, ?verticalScrollBarVisibility=verticalScrollBarVisibility, ?gestureRecognizers=gestureRecognizers,
?horizontalOptions=horizontalOptions, ?margin=margin, ?verticalOptions=verticalOptions, ?anchorX=anchorX, ?anchorY=anchorY,
?backgroundColor=backgroundColor, ?behaviors=behaviors, ?flowDirection=flowDirection, ?height=height, ?inputTransparent=inputTransparent,
?isEnabled=isEnabled, ?isTabStop=isTabStop, ?isVisible=isVisible, ?minimumHeight=minimumHeight, ?minimumWidth=minimumWidth,
?opacity=opacity, ?resources=resources, ?rotation=rotation, ?rotationX=rotationX, ?rotationY=rotationY,
?scale=scale, ?scaleX=scaleX, ?scaleY=scaleY, ?styles=styles, ?styleSheets=styleSheets,
?tabIndex=tabIndex, ?translationX=translationX, ?translationY=translationY, ?visual=visual, ?width=width,
?style=style, ?styleClasses=styleClasses, ?shellBackButtonBehavior=shellBackButtonBehavior, ?shellBackgroundColor=shellBackgroundColor, ?shellDisabledColor=shellDisabledColor,
?shellForegroundColor=shellForegroundColor, ?shellFlyoutBehavior=shellFlyoutBehavior, ?shellNavBarIsVisible=shellNavBarIsVisible, ?shellSearchHandler=shellSearchHandler, ?shellTabBarBackgroundColor=shellTabBarBackgroundColor,
?shellTabBarDisabledColor=shellTabBarDisabledColor, ?shellTabBarForegroundColor=shellTabBarForegroundColor, ?shellTabBarIsVisible=shellTabBarIsVisible, ?shellTabBarTitleColor=shellTabBarTitleColor, ?shellTabBarUnselectedColor=shellTabBarUnselectedColor,
?shellTitleColor=shellTitleColor, ?shellTitleView=shellTitleView, ?shellUnselectedColor=shellUnselectedColor, ?automationId=automationId, ?classId=classId,
?effects=effects, ?menu=menu, ?styleId=styleId, ?ref=ref, ?tag=tag,
?selectionChanged=selectionChanged, ?scrolled=scrolled, ?focused=focused, ?unfocused=unfocused, ?created=created)
attribBuilder
static member CreateCollectionView () : Xamarin.Forms.CollectionView =
upcast (new Fabulous.XamarinForms.CustomCollectionView())
static member UpdateCollectionView (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.CollectionView) =
ViewBuilders.UpdateGroupableItemsView (prevOpt, curr, target)
static member inline ConstructCollectionView(?groupFooterTemplate: Xamarin.Forms.DataTemplate,
?groupHeaderTemplate: Xamarin.Forms.DataTemplate,
?isGrouped: bool,
?selectedItem: int option,
?selectedItems: int list option,
?selectionMode: Xamarin.Forms.SelectionMode,
?footer: obj,
?header: obj,
?itemsLayout: Xamarin.Forms.IItemsLayout,
?emptyView: ViewElement,
?horizontalScrollBarVisibility: Xamarin.Forms.ScrollBarVisibility,
?itemSizingStrategy: Xamarin.Forms.ItemSizingStrategy,
?itemsUpdatingScrollMode: Xamarin.Forms.ItemsUpdatingScrollMode,
?items: ViewElement list,
?remainingItemsThreshold: int,
?remainingItemsThresholdReachedCommand: unit -> unit,
?re
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment