Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF进度条从100%增加到1%_C#_Wpf_Progress Bar - Fatal编程技术网

C# WPF进度条从100%增加到1%

C# WPF进度条从100%增加到1%,c#,wpf,progress-bar,C#,Wpf,Progress Bar,我有一个WPF progressbar,我想报告将流的字节传输到数据库的进度。但是,我将剩余字节除以total,再乘以100: int percentage = (int) (streamlength / BytesLeft) * 100; 基本上是从100到1,有没有办法在进度条上表示这个 <ProgressBar HorizontalAlignment="Left" Height="21" Margin="723,204.2,0,0" VerticalAlignment=

我有一个WPF progressbar,我想报告将流的字节传输到数据库的进度。但是,我将剩余字节除以total,再乘以100:

    int percentage = (int) (streamlength / BytesLeft) * 100;
基本上是从100到1,有没有办法在进度条上表示这个

  <ProgressBar HorizontalAlignment="Left" Height="21" Margin="723,204.2,0,0" VerticalAlignment="Top" Width="411" Minimum="0" Maximum="100" Name="pbStatus" Value="{Binding BytesToDatabase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" />

如果没有,我将更改计算。

您应该切换这两个(
streamlength
bytesleet
):


它从100变为1???@Sayse:我猜是一个拼写错误,否则它根本无法编译。对不起,这是一个拼写错误,这是我提出的一个愚蠢的问题,可能最好删除它
int percentage = (int) (BytesLeft / streamlength) * 100;