0

I am adding like this content view which is having its own view model.I want to handle its visibility from view model of content page.

    <ContentPage>
    <local:ContentView1 IsVisible="{Binding IsContentViewVisible}"/>
    </ContentPage>

Here is page's view model binding for content view's hiding and showing public bool IsContentViewVisible{get;set;} and then i am using it by giving true or false. I am using Fody so there is no need of INotifyPropertyChanged I assume.

Dolma
  • 1
  • 1
  • why isn't `IsContentViewVisible` working for you? – Jason Aug 21 '20 at 13:48
  • dont knw that is the question.I can see the binding happening properly but the view is not hiding – Dolma Aug 21 '20 at 13:55
  • where is the code for your VM? Is your page's BindingContext set correctly? Does your VM implement INotifyPropertyChanged? – Jason Aug 21 '20 at 13:56
  • I am using Fody so no need for INotifyPropertyChanged.In view model i have created property as 'public bool IsContentViewVisible{get;set;}' and i am setting true or false to this – Dolma Aug 21 '20 at 14:10
  • 1
    with Fody your class still needs to implement INPC - see https://github.com/Fody/PropertyChanged#overview – Jason Aug 21 '20 at 15:40
  • Does my solution work for you? If yes, can you please accept it (click the ☑️ in the upper left corner of this answer ) so that we can help more people with same problem:). – nevermore Aug 25 '20 at 01:40

1 Answers1

0

Through the document,

You need to implement INotifyPropertyChanged for you ViewModel:

NOTE: All classes that implement INotifyPropertyChanged will have notification code injected into property setters.

nevermore
  • 15,432
  • 1
  • 12
  • 30