Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Binding Visibility MVVM tabbedPage

$
0
0

Hello,
I have a problem with this code:

using System;
using Visites.Pages;
using Visites.ViewsModels;
using Xamarin.Forms;

namespace Visites.TabbedPages
{
    public class VisitTabbedPage : TabbedPage
    {
        public VisitTabbedPage()
        {
            BindingContext = new VisitTabbedPageViewModel();
            Children.Add(new InformationsPage());

            OptionnalSelectionsPage optionnal_selection_page = new OptionnalSelectionsPage();
            optionnal_selection_page.SetBinding(IsVisibleProperty, "TabbedPageVisible");
            Children.Add(optionnal_selection_page);

            FindingsPage finding_page = new FindingsPage();
            finding_page.SetBinding(IsVisibleProperty, "TabbedPageVisible");
            Children.Add(finding_page);

            RemarksPage remarks_page = new RemarksPage();
            remarks_page.SetBinding(IsVisibleProperty, "TabbedPageVisible");
            Children.Add(remarks_page);
        }
    }
}




using System;
using System.ComponentModel;

namespace Visites.ViewsModels
{
    public class VisitTabbedPageViewModel : INotifyPropertyChanged
    {

        public bool TabbedPageVisible()
        {
            return (App.CurrentVisit.StartDateTime != null) ? true : false;
        }

        #region PropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;
        internal virtual void OnPropertyChanged(string property_name)
        {
            if (this.PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(property_name));
        }

        #endregion
    }
}

Can you help me to understand why it does not working?
Thanks you.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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