How to trigger IsVisible = true if binding first item from a list in XAML?

Adeel984Adeel984 Member ✭✭✭

i've a layout in which i want a Frame to be visible if index is 0 rest it should be invisible, how can i get this done?

Here is my layout

   <StackLayout x:Name="stackLv">
                                     <StackLayout Orientation="Horizontal" Margin="10,5" BindingContextChanged="onStackBindingContextChanged">
                                             <TapGestureRecognizer Tapped="MethodTapped"/>
                         <Image Source="onp.png" HeightRequest="25" WidthRequest="20"/>
                         <Label Text="{Binding Name}" Margin="10,5"/>

            <!-- I want to set this Frame property to true when bind first item rest it should be invisible -->

                          <Frame Padding="0" BorderColor="{DynamicResource appbasiColor}" HeightRequest="20" WidthRequest="20"
                                 HorizontalOptions="EndAndExpand" VerticalOptions="CenterAndExpand" HasShadow="False"
                                 CornerRadius="10" IsVisible="False">
                              <Frame Padding="0" BackgroundColor="{DynamicResource appbasiColor}" HeightRequest="10"
                                 HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" HasShadow="False"
                                 CornerRadius="5"  WidthRequest="10"/>
                           <BoxView HeightRequest="1.2" BackgroundColor="{DynamicResource appbasiColor}"
                             VerticalOptions="StartAndExpand" Margin="10,0"/>



  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Index is 0 rest what does it mean?

    You can have a property in your viemodel like

    Public Boolean IsFrameVisible {get{ return list.cout > 0 and list[0].something == true}}
Sign In or Register to comment.