I'm newbie in MVVM . I have two xaml pages. the second one cannot be accessed ( Locked ) unless the button from the first page (Introduction page) has been clicked. How can I do that?
The lock page has this code.
<Frame Grid.Row="0" Grid.Column="1" BackgroundColor="LightGray" IsVisible="{Binding LockPage}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tap_Lock" />
</Frame.GestureRecognizers>
<Label Text="Locked"/>
</Frame>
The Introduction page has this code.
<StackLayout>
<Label Text="This is only a simple Introduction Text."/>
<Label Text=""/>
<Button Text="Lets Go!!" Command="{Binding UnlockPageCommand}" Clicked="Tap_Next"/>
This is the the class LockModule.cs
public class LockModule : INotifyPropertyChanged
{
public LockModule()
{
UnlockPageCommand = new Command(UnlockPage);
}
bool lockPage = true;
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(string lockpage)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(lockpage));
}
public bool LockPage
{
get { return lockPage; }
set
{
lockPage = value;
OnPropertyChanged(nameof(LockPage));
}
}
public Command UnlockPageCommand { get; }
void UnlockPage()
{
if (lockPage == true)
{
lockPage = false;
}
else
{
lockPage = true;
}
OnPropertyChanged(nameof(LockPage));
}
}
and it's not working