1

I have a WPF application. If I write only grid hide show on button click then it is working. But if I write any code below that, it is not working.

<Grid Margin="0">
    <Grid x:Name="nonLoading" Margin="0" Visibility="{Binding Path=GridVisibility}">
    </Grid>

private Visibility _gridVisibility = Visibility.Visible;
    public Visibility GridVisibility
    {
        get
        {
            return _gridVisibility;
        }
        set
        {
            _gridVisibility = value;
        }
    }

How can I fix this?

petezurich
  • 9,280
  • 9
  • 43
  • 57
nirav
  • 29
  • 4
  • http://www.daedtech.com/wpf-and-notifying-property-change/ you need to implement INotifyPropertyChange interface to update UI when you change binding – Anant Dabhi Jul 12 '17 at 06:49

1 Answers1

1

Please implement INotifyPropertyChanged interface

private Visibility _gridVisibility = Visibility.Visible;
public Visibility GridVisibility
{
    get
    {
        return _gridVisibility;
    }
    set
    {
        _gridVisibility = value;
        NotifyPropertyChanged();
    }
}
IamNvr
  • 11
  • 2