Forum Xamarin.Forms

Stacklayout visibility not working inside listview

A_VA_V USMember ✭✭✭
edited October 2018 in Xamarin.Forms

Hi,I am using stacklayout inside listview like

<ListView ItemsSource="{Binding Items}" x:Name="listView" SeparatorVisibility="None" HasUnevenRows="True" SelectedItem="{Binding SelectedItem}">
                 ------- Column1
<StackLayout x:Name="completeService"  Padding="0" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" Spacing="0" Grid.Column="4" IsVisible="{Binding CompleteServiceVisiblity}">
                                        <!--Converter={StaticResource boolConvert}-->
                                        <Label  Text="{Binding CompleteServiceText}">
                                                <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="CompleteService_Tapped"/>
                                        <BoxView x:Name="customBox" BackgroundColor="#658fb2" HeightRequest="1"/>

I set my stacklayout visibility false in my ViewModel like

 public class MyViewModel : INotifyPropertyChanged
      private bool _completeServiceVisiblity;
        public bool CompleteServiceVisiblity
            get { return _completeServiceVisiblity; }
                _completeServiceVisiblity = value;

    private string _completeServiceText { get; set; }
    public string CompleteServiceText
        get { return _completeServiceText; }
            _completeServiceText = value;

       public MyViewModel ()
            CompleteServiceVisiblity = false;
            CompleteServiceText = "Complete Service";
       public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string property)
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));

but my stacklayout is still showing!! and if I set Visibility true CompleteServiceText is not showing. Can anybody please help me what I am doing worng.


Sign In or Register to comment.