I am going through the tutorials on how to implement INotifyPropertyChanged for a progressbar and I think i am a bit confused.
This is my XAML code snippet:
<ProgressBar Name="progressBar" Height="24" IsIndeterminate="{Binding IsIndeterminate}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Value="{Binding ProgressValue}"/>
and this is my code-behind snippet:
public partial class MainWindow : System.Windows.Window {
public bool IsInderteminate { get; set; }
public double Minimum { get; set; }
public double Maximum { get; set; }
public double ProgressValue { get; set; }
public MainWindow() {
InitializeComponent();
this.progressBar.DataContext = this;
this.IsInderteminate = false;
}
private void btnLoadPremiumDetail_Click(object sender, RoutedEventArgs e) {
this.IsInderteminate = true;
// I do my work here
this.IsInderteminate = false;
}
private void _ValidateProcurementDetail() {
for (int i = 0; i < rowCount; i++) {
this.ProgressValue += 1;
//I do work here
}
}
}
How do i implement the INotifyPropertyChanged so that my progressBar gets updated everytime I set the ProgressValue or IsIndeterminate?