Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

How to hide out a StackLayout in ViewCell?

$
0
0

Dear friends,

I have a custom class derived from ViewCell,my code as followed:

class QilingViewCell:ViewCell
{

    public QilingViewCell()
    {
        Image image = new Image
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
        };
        image.SetBinding(Image.SourceProperty, "IconImage");

        Label titleLabel = new Label
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            FontSize = 15,
            FontAttributes = Xamarin.Forms.FontAttributes.Bold,
            TextColor = Color.White
        };
        titleLabel.SetBinding(Label.TextProperty, "Title");

        Label descLabel = new Label
        {
            HorizontalOptions = LayoutOptions.Start,
            FontSize = 12,
            TextColor = Color.White
        };
        descLabel.SetBinding(Label.TextProperty, "Description");

        QilingCheckBox chk = new QilingCheckBox
        {
            HorizontalOptions = LayoutOptions.End,
            VerticalOptions = LayoutOptions.Center,
            IsVisible = true,
            Checked = false

        };

        chk.SetBinding(QilingCheckBox.CheckedProperty, "IsSelected");


        StackLayout viewLayoutImage = new StackLayout()
        {
            HorizontalOptions = LayoutOptions.Start,
            Orientation = StackOrientation.Vertical,
            Padding = 3,
            Children = { image }
        };

        StackLayout viewLayoutItem = new StackLayout()
        {
            HorizontalOptions = LayoutOptions.StartAndExpand,
            Orientation = StackOrientation.Vertical,
            Padding = 15,
            Children = { titleLabel, descLabel }
        };

        StackLayout checkLayoutItem = new StackLayout()
        {
            HorizontalOptions = LayoutOptions.End,
            Orientation = StackOrientation.Vertical,
            Padding = 15,
            Children = { chk }
        };


        StackLayout viewLayout = new StackLayout()
        {
            HorizontalOptions = LayoutOptions.StartAndExpand,
            Orientation = StackOrientation.Horizontal,
            BackgroundColor = Color.Black,
            Children = { viewLayoutImage, viewLayoutItem, checkLayoutItem }
        };

        View = viewLayout;
    }
}

My question is HOW TO HIDE OUT THE "checkLayoutItem" StackLayout ?It seems that StackLayout.IsVisible does not work!

Any help will be appreciated!

Jerry


Viewing all articles
Browse latest Browse all 75885


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>