How use x:Reference/Path for binding in XAML

voidstreamvoidstream FRMember ✭✭✭
edited January 2017 in Xamarin.Forms

Hello,

I have a content page with a x:Name property (=HomePage).
I have in this contentpage a listview with a x:Name property (=LV_Detachments).

I'm trying to bind in XAML the IsVisible property of LV_Detachments like this:

            <BoxView.Triggers>
                <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference HomePage}, Path=BindingContext.LV_Detachments.IsVisible}" Value="True">
                    <Setter Property="BackgroundColor" Value="White"/>
                </DataTrigger>
                <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference HomePage}, Path=BindingContext.LV_Detachments.IsVisible}" Value="False">
                    <Setter Property="BackgroundColor" Value="Red"/>
                </DataTrigger>
            </BoxView.Triggers>     

But it's not work :(

Best regards

Posts

  • voidstreamvoidstream FRMember ✭✭✭

    Ok i solve my problem like this:

                <BoxView.Triggers>
                    <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference LV_Detachments}, Path=IsVisible}" Value="True">
                        <Setter Property="BackgroundColor" Value="Green"/>
                    </DataTrigger>
                    <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference LV_Detachments}, Path=IsVisible}" Value="False">
                        <Setter Property="BackgroundColor" Value="Red"/>
                    </DataTrigger>
                </BoxView.Triggers>
    
Sign In or Register to comment.