I want to show the progress bar on uploading a file
xaml
<ProgressBar HorizontalAlignment="Left" Height="30" Margin="145,6,0,0" VerticalAlignment="Top" Width="469" Value="{Binding progressBar1,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" />
This is my progress control
model.cs
public string progressBar1
{
get
{
return _ProgressBar;
}
set
{
_ProgressBar = value;
OnPropertyChanged("progressBar1");
}
}
ViewModel
private Files _FileDetails;
public Files FilesDetails
{
get
{
return _FileDetails;
}
set
{
_FileDetails = value;
}
}
//some code
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
FilesDetails.progressBar1.Value = e.ProgressPercentage;
if ((progressBar1.Value / 2) == 0)
{
lblStatus.Content = "Downloading.";
}
else if ((progressBar1.Value / 3) == 0)
{
lblStatus.Content = "Downloading..";
}
else if ((progressBar1.Value / 5) == 0)
{
lblStatus.Content = "Downloading...";
}
lblStatus.Content = "Download " + filesizedownloaded.ToString("F2") + " / " + filesize.ToString("F2")
+ " ( " + progressBar1.Value.ToString() + " ) % Complete.";
}
in worker_ProgressChanged function i cant access the value of progressBar1.Shows error under "value"
string' does not contain a definition for 'Value' and no accessible extension method 'Value' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
shows the above error on hover the value
progressBar1.Valuewhich is a string and doesn't have a reference to Value. You probably meantFilesDetails.progressBar1.Value