First of all I feel really bad to ask this but I hope you can help me. I have a windows phone 7.1 one application with a progressbar. I would like to bind the progressbar TwoWay mode but I have tried a lot and could't find any solution.
ViewModel:
public class CollectionViewModel : INotifyPropertyChanged
{
private bool _isLoading;
public bool IsLoading
{
get { return _isLoading; }
set
{
if (_isLoading != value)
{
_isLoading = value;
NotifyPropertyChanged("IsLoading");
}
}
}
}
In my PivotPage I bind an instance of my collectionViewModel to my PivotItem like this:
public partial class Main_PivotPage : PhoneApplicationPage
{
CollectionViewModel _collectionViewModel;
public Main_PivotPage()
{
InitializeComponent();
_collectionViewModel = new CollectionViewModel();
collectionPivotItem.DataContext = _collectionViewModel;
}
}
Inside this pivotpage I have the ProgressBar that is bind to the IsLoading property.
XAML
<ProgressBar IsIndeterminate="{Binding IsLoading, Mode=TwoWay}"/>
When I change the value of that property to true nothing will happen. The progressbar won't start loading.
Well, I didn't mention that I nested the progressbar into a listfooter. That was the problem. However the weird thing is, that the binded datacontext is working for my longlistselector but not for the listfooter in it. I had to bind the datacontext separately to the progressBar just like this:
collectionPivotItem.DataContext = _collectionViewModel;
progressBar.DataContext = _collectionViewModel;
This solved my problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.