I am making an app which has infinite scrolling while showing its results. I want to place a textblock with loading message at the bottom if the data is not loaded by the time the user scrolls to the bottom. In the visibility property of the textblock i did as following:
Visibility="{Binding IsLoading, Converter={StaticResource visibilityConverter}}"
And the visibility converter is:
public class VisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
return bool.Parse(value.ToString()) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
{
return DependencyProperty.UnsetValue;
}
}
I want to change the visibility by saying
App.ViewModel.IsLoading = true;// or false
But the visibility is being changed only in the page load, only once and not on changing the ViewModel. Am I doing some thing wrong or Is it not the way of doing it ?
2 things:
You can use default BooleanToVisibilityConverter. See http://msdn.microsoft.com/en-us/library/system.windows.controls.booleantovisibilityconverter.aspx
See if you have raised NotfiyPropertyChanged in IsLoading property setter.