Merge pull request #292 from EricEzaM/progress-bar-text-customisation

Add documentation for ProgressBar text customisation.
This commit is contained in:
Dan Walmsley 2022-09-03 16:17:31 +01:00 коммит произвёл GitHub
Родитель 6d93712d46 fd8f62deea
Коммит 217f68bb07
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 20 добавлений и 1 удалений

Двоичные данные
.gitbook/assets/progressbar (1).png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -2,6 +2,26 @@
The `ProgressBar` control allow for showing dynamic progress status.
### Customising the progress text
When [`ShowProgressText`](http://reference.avaloniaui.net/api/Avalonia.Controls/ProgressBar/590A8B3E) is `true`, text on the progress bar will be displayed.
![Basic Progress Bar](<../../.gitbook/assets/progressbar (1).png>)
By default this text shows the percentage completion, according to the [`Value`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/E111DF5B), [`Minimum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/8F9BD1EA) and [`Maximum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/C07B22E9). The format of this text can be customised by using the `ProgressTextFormat` property. This expects a string which will be passed to a [`string.Format`](https://docs.microsoft.com/en-us/dotnet/api/system.string.format#system-string-format(system-string-system-object())) call with the value of `ProgressTextFormat` as the format string. The following format items are available at the given indices:
* 0 = Value
* 1 = Value as a Percentage from 0 to 100 (e.g. `Minimum = 0`, `Maximum = 50`, `Value = 25`, then `Percentage = 50`)
* 2 = Minimum
* 3 = Maximum
#### Progress Text Format Example
|Min |Max |Value |Format String |Output |
|----|----|------|---------------------------------|-----------------------------|
|0 |20 |17 |`{0}/{3} Tasks Complete ({1:0}%)`|`17/20 Tasks Complete (85%)` |
### Reference <a id="reference"></a>
[ProgressBar](http://reference.avaloniaui.net/api/Avalonia.Controls/ProgressBar/)
@ -9,4 +29,3 @@ The `ProgressBar` control allow for showing dynamic progress status.
### Source code <a id="source-code"></a>
[ProgressBar.cs](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/ProgressBar.cs)