I am not new to Xamarin Forms, but kind of failed to understand why the does not hide when some properties change.
My Grid:
<Grid Grid.Row="0" BackgroundColor="Red" IsVisible="False" x:Name="GridA"> </Grid>
It's C# code; ...xaml.cs;
[XamlCompilation(XamlCompilationOptions.Compile)] public partial class NetworkErrorBottom { protected BaseViewModel net = new BaseViewModel(); public NetworkErrorBottom () { InitializeComponent (); GridNetworkError.IsVisible = net.IsReloadPreviousPage; } }
I have another file in ViewModel which controls the change;
` public class BaseViewModel : INotifyPropertyChanged
private bool _isReloadPreviousPage;
public bool IsReloadPreviousPage
{
get { return _isReloadPreviousPage; }
set { _isReloadPreviousPage = value; OnPropertyChanged(); }
}
}`
Network.xaml file, which holds the GridA gets embedded into the main page, and IsVisible = False by default. I want to display GridA only if no network by setting IsReloadPreviousPage = true
Network check is done from another class
public void NetworkCheck(){ if(!Connected){ changeNetStatus.IsReloadPreviousPage = true; } }
Please note: GridA get displayed/hidden if IsReloadPreviousPage is hard coded inside the ViewModel.
Where I am I getting it wrong? Any Idea guys?
Thanks.