Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve type 'Expander'

I have an Expander that no longer accepts the Expander value in the Binding in the AncestorType property. It used to work, but since I upgraded to Xamarin forms version 5.0.0 it doesn't work anymore and Visual Studio reports me the following error:

Error XFC0000 Cannot resolve type "Expander".

<xct:Expander.Header>
        <Image Source="ExpanderPlus.png" WidthRequest="30" HeightRequest="30" Rotation="180">
             <Image.Triggers>
                    <DataTrigger TargetType="Image"
                                 Binding="{Binding Source={RelativeSource AncestorType={x:Type Expander}}, Path=IsExpanded}"
                                 Value="True">
                            <Setter Property="Source" Value="ExpanderClose.png"/>
                    </DataTrigger>
             </Image.Triggers>
        </Image>
</xct:Expander.Header>
like image 322
signalover Avatar asked Oct 14 '25 08:10

signalover


1 Answers

Since Expander is not defined in Xamarin.Forms, you need to specify that it is defined in xct namespace (from Expander was not found in Xamarin Forms 5.0.0) in your AncestorType, similar to when you consume it you don't do <Expander ..> but <xct:Expander ..>.

xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
Binding="{Binding Source={RelativeSource AncestorType={x:Type xct:Expander}},
                      Path=IsExpanded}" Value="True">
like image 86
Cfun Avatar answered Oct 18 '25 03:10

Cfun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!