0
DirectoryInfo dirInfo = new DirectoryInfo(strSource);
FileInfo[] files = dirInfo.GetFiles();
pgb.Maximum = files.Length-1;
Thread thread = new Thread(new ThreadStart(() =>
{
for (int n = 0; n < files.Length; n++)
{
FileInfo tempfile = files[n];
string path = System.IO.Path.Combine(strDestination, tempfile.Name);
tempfile.CopyTo(path, true);
pgb.Dispatcher.BeginInvoke(new Action<int>((x) => pgb.Value = x),
DispatcherPriority.Background, n);
}
}));
thread.Start();
我想表明复制的文件的进度条,其中的标签上的百分比:
percent = n/pgb.Maximum
谁能帮助我?谢谢!
您可以通过文本块结合到进度条值即 –
auburg
我可以在代码后面执行它吗?在xalm中不使用绑定 – cptJack44
@ cptJack44可以在代码后面执行任何操作 – AnjumSKhan