0

When set Expander direction an error message is displayed

System.InvalidOperationException: 'Header not initialized'

<xct:Expander Direction="Left">
    <xct:Expander.Header>
        <Label Text="H" TextColor="Black"/>
    </xct:Expander.Header>
    <StackLayout Orientation="Horizontal" >
        <Label Text="!" TextColor="Black" />
        <Label Text="D" TextColor="Red" />
    </StackLayout>
</xct:Expander>

The code works fine if there is no direction attribute.

Cfun
  • 8,442
  • 4
  • 30
  • 62
Sherif Awad
  • 171
  • 2
  • 10

2 Answers2

0

This is a known bug https://github.com/xamarin/XamarinCommunityToolkit/issues/1144 which has been fixed in this pr and will be available on a next release.

Cfun
  • 8,442
  • 4
  • 30
  • 62
0

Setting the direction after the header definition made it works for me.

<xct:Expander>
    <xct:Expander.Header>
        <Label Text="H" TextColor="Black"/>
    </xct:Expander.Header>
    <xct:Expander.Direction>
        <xct:ExpandDirection>Left</xct:ExpandDirection>
    </xct:Expander.Direction>
    <StackLayout Orientation="Horizontal" >
        <Label Text="!" TextColor="Black" />
        <Label Text="D" TextColor="Red" />
    </StackLayout>
</xct:Expander>
ume05rw
  • 11
  • 2