i´am looking for a solution in C# and WPF. I try to upload multiple files to a server. Every upload should be shown in the listbox within a progressbar.
I have a WPF listbox template with a progress bar and a textblock in it:
<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 a progress bar in this list?
Can somebody help me to find the correct solution? :)