Practically impossible to say without a concise-but-complete code
example that reliably reproduces the problem.
Are you sure you're actually setting the properties correctly? That is,
setting the properties representing the values you really want to
update, on the correct objects representing the GUI you want to be changed?
Pete
I ended up changing the code little bit more than what I explained,
regardless here is the code
private void button1_Click(object sender, RoutedEventArgs e)
{
DirectoryInfo directoryDetail = new
DirectoryInfo(driveLetter.Text);
progressBar1.Minimum = 0;
progressBar1.Maximum =
directoryDetail.GetDirectories().Length;
TreeViewItem item = new TreeViewItem();
item.Header = driveLetter.Text;
directoryTree.Items.Add(item);
label1.Content = driveLetter.Text;
BuildTree(directoryDetail, item);
}
private void BuildTree(DirectoryInfo directoryDetail,
TreeViewItem parent)
{
foreach (string dirName in
Directory.GetDirectories(directoryDetail.FullName))
{
TreeViewItem item = new TreeViewItem();
item.Header = dirName;
parent.Items.Add(item);
DirectoryInfo dInfo = new DirectoryInfo(dirName);
try
{
if (dInfo.GetDirectories().Length > 0)
{
BuildTree(dInfo, item);
}
if (parent.Header.ToString() ==
driveLetter.Text.ToString())
{
progressBar1.Value += 1;
label1.Content = dirName;
progressBar1.InvalidateVisual();
label1.InvalidateVisual();
}
}
catch
{
}
}
foreach(string fileName in
Directory.GetFiles(directoryDetail.FullName))
{
TreeViewItem fileitem = new TreeViewItem();
fileitem.Header = fileName;
parent.Items.Add(fileitem);
}
}