RepositoryItemProgressBar.PercentView Property

Gets or sets whether to present the current position as a relative value between the RepositoryItemProgressBar.Minimum and RepositoryItemProgressBar.Maximum and format it as a percentage. The RepositoryItemBaseProgressBar.ShowTitle property must be set to true.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

[DXCategory("Behavior")]
[DefaultValue(true)]
public bool PercentView { get; set; }
<DXCategory("Behavior")>
<DefaultValue(True)>
Public Property PercentView As Boolean

Property Value

Type Default Description
Boolean

true

true to present the current position as a relative value; false to present the current position as an absolute value.

Remarks

PercentView

Set the RepositoryItemBaseProgressBar.ShowTitle property to true to display text in the progress bar.

To apply custom formatting to the control's value, use the RepositoryItem.DisplayFormat property.

To provide a custom display text, handle the RepositoryItem.CustomDisplayText event.

Examples

In the code fragment below, a DeleteFiles method removes all files contained within the directory specified by the source parameter. The ProgressBarControl is used to display the progress of file delete operations. The RepositoryItemProgressBar.Minimum and RepositoryItemProgressBar.Maximum properties are used to specify a range for the progress bar that is equivalent to the number of files to be removed. The code also uses the RepositoryItemProgressBar.Step property with the ProgressBarControl.PerformStep method, to increment the position of the progress bar as soon as a file is removed.

using System.IO;
using DevExpress.XtraEditors.Controls;
// ...
private void DeleteFiles(string source){
   if (Directory.Exists(source)){
      string[] fileEntries = Directory.GetFiles(source);
      // Initializing progress bar properties
      progressBarControl1.Properties.Step = 1;
      progressBarControl1.Properties.PercentView = true;
      progressBarControl1.Properties.Maximum = fileEntries.Length;
      progressBarControl1.Properties.Minimum = 0;
      // Removing the list of files found in the specified directory
      foreach(string fileName in fileEntries){
         File.Delete(fileName);
         progressBarControl1.PerformStep();
         progressBarControl1.Update();
      }
   }
}
// ...
DeleteFiles("d:\\Temp");
See Also