Reputation: 47
sorry for my bad english :x
I use MVVM Light toolkit on my project and i try to collapsed and restored a progressbar but i have used a lot of snippet and browse a lot of forums around this subject and i can not solve my problem.
My Home.xaml
<ProgressBar Minimum="0" Maximum="100" Height="16" IsIndeterminate="True" Visibility="{Binding ProgressBarVisibility}"/>
My HomeViewModel :
private System.Windows.Visibility progressBarVisibility;
public System.Windows.Visibility ProgressBarVisibility
{
get { return progressBarVisibility; }
set
{
progressBarVisibility = value;
RaisePropertyChanged("ProgressBarVisibility");
}
}
/// <summary>
/// Initializes a new instance of the HomeViewModel class.
/// </summary>
public HomeViewModel()
{
this.ContentStatutBar = "Recherche de mises à jour en cours";
this.ProgressBarVisibility = Visibility.Visible;
this.DownButtonVisibility = System.Windows.Visibility.Collapsed;
this.flag = false;
this.fakeButtonAction = new RelayCommand(() => this.update());
}
public void update()
{
if (!this.flag)
{
this.flag = true;
this.ContentStatutBar = "Une mise à jour en attente";
this.progressBarVisibility = Visibility.Collapsed;
this.DownButtonVisibility = System.Windows.Visibility.Visible;
}
else
{
this.flag = false;
this.ContentStatutBar = "Aucune mises à jour";
this.progressBarVisibility = Visibility.Visible;
this.DownButtonVisibility = System.Windows.Visibility.Collapsed;
}
this.ContentStatutBar = this.DownButtonVisibility.ToString();
}
When i use my update method in my Home.xaml.cs it's work (not binding --> (progressbar.Visibility = Visibility.Visible)) but when i try to use this by binding in my VM it's don't work :[
Can you help me please ?
Best Regards ;)
Upvotes: 1
Views: 1817
Reputation: 18578
You are changing the field, update the property in your update method
this.ProgressBarVisibility = Visibility.Visible;
Upvotes: 3