I am looking for a solution in C # and WPF. I am trying to upload multiple files to a server. Each download should be listed in the progress bar.
I have a WPF list template with a progress bar and a text block:
<ListBox Name="lbUploadList" HorizontalContentAlignment="Stretch" Margin="530,201.4,14.2,33.6" Grid.Row="1"> <ListBox.ItemTemplate> <DataTemplate> <Grid Margin="0,2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="100" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding File}" /> <ProgressBar Grid.Column="1" Minimum="0" Maximum="100" Value="{Binding Percent}" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> public class UploadProgress { public string File { get; set; } public int Percent { get; set; } } List<UploadProgress> uploads = new List<UploadProgress>(); uploads.Add(new UploadProgress() { File = "File.exe", Percent = 13 }); uploads.Add(new UploadProgress() { File = "test2.txt", Percent = 0 }); lbUploadList.ItemsSource = uploads;
How can I update the progress bar on this list?
Can someone help me find the right solution? :)
source share