HeaderPane
Main
Hide
Share Link
Print

Task Dialog Elements

Besides its text and buttons, a task dialog page can hold radio buttons, a verification check box, an expander, a footnote and a progress bar. Each element is an object the page refers to. While the page is shown, the changes Task Dialog lists show in the dialog at once, and the other properties throw an InvalidOperationException. A verification check box, an expander or a footnote without text, and a progress bar whose state is SftTaskDialogProgressBarState.None, are not shown and cannot be changed while the page is shown.

Radio Buttons

SftTaskDialogPage.RadioButtons holds SftTaskDialogRadioButton objects, shown in the content area below the text. Checking one unchecks the others of the collection; a page whose radio buttons were added already checked can have at most one checked when it is shown. While the page is shown, SftTaskDialogRadioButton.CheckedChanged occurs when the user checks a radio button or the application sets SftTaskDialogRadioButton.Checked to True, first for the radio button that was checked, then for the new one; a radio button cannot be unchecked then, and Checked cannot be set in a CheckedChanged handler. SftTaskDialogRadioButton.Enabled disables one.

C#

page.RadioButtons.Add("&Comma-separated values (.csv)").Checked = true;
SftTaskDialogRadioButton pdf = page.RadioButtons.Add("&PDF document");

VB

page.RadioButtons.Add("&Comma-separated values (.csv)").Checked = True
Dim pdf As SftTaskDialogRadioButton = page.RadioButtons.Add("&PDF document")

After the dialog closes, the radio buttons' SftTaskDialogRadioButton.Checked properties hold the user's choice.

Verification Check Box

SftTaskDialogPage.Verification is a check box at the left of the buttons, typically for a choice such as "Don't show this again" (SftTaskDialogVerificationCheckBox.Text and SftTaskDialogVerificationCheckBox.Checked). SftTaskDialogVerificationCheckBox.CheckedChanged occurs while the page is shown, when the user or the application changes Checked. A string converts to a verification check box, so page.Verification = "&Don't show this again" adds one.

Expander

SftTaskDialogPage.Expander adds a button that shows and hides more text (SftTaskDialogExpander.Text). The button reads "See details" and "Hide details", which are English in every language of Windows, or SftTaskDialogExpander.CollapsedButtonText and SftTaskDialogExpander.ExpandedButtonText. SftTaskDialogExpander.Expanded shows the text when the dialog opens; while the page is shown the user expands and collapses it, and SftTaskDialogExpander.ExpandedChanged occurs. SftTaskDialogExpander.Position places the text after the text of the dialog (SftTaskDialogExpanderPosition.AfterText, the default) or after the footnote (SftTaskDialogExpanderPosition.AfterFootnote).

Footnote

SftTaskDialogPage.Footnote is a text below the buttons (SftTaskDialogFootnote.Text) with an optional icon (SftTaskDialogFootnote.Icon). A string converts to a footnote, so page.Footnote = "Exports are kept for 30 days." adds one.

Progress Bar

SftTaskDialogPage.ProgressBar shows a progress bar below the text. SftTaskDialogProgressBar.Minimum, SftTaskDialogProgressBar.Maximum and SftTaskDialogProgressBar.Value, each from 0 to 65535 (0, 100 and 0 by default), define the progress; SftTaskDialogProgressBar.State shows it, and SftTaskDialogProgressBar.MarqueeSpeed sets the time between two steps of the marquee animation:

ValueDescription
SftTaskDialogProgressBarState.NormalThe value, in the normal color. This is the default.
SftTaskDialogProgressBarState.PausedThe value, in the paused color.
SftTaskDialogProgressBarState.ErrorThe value, in the error color.
SftTaskDialogProgressBarState.MarqueeContinuous activity without a value.
SftTaskDialogProgressBarState.MarqueePausedThe marquee progress bar without activity.
SftTaskDialogProgressBarState.NoneNo progress bar. A page shown with this state cannot show the progress bar later, and a shown progress bar cannot get this state.

The progress is usually updated from a timer started in the page's SftTaskDialogPage.Created event, or from work running on another thread through the owner's BeginInvoke, since the dialog runs on the user interface thread.

Links

With SftTaskDialogPage.EnableLinks set to True, text in the form <a href="value">link text</a> in the text, the expanded text and the footnote is shown as a link. A click on it raises SftTaskDialogPage.LinkClicked, whose event data hold the href value (SftTaskDialogLinkClickedEventArgs.LinkHref); the application opens the link or shows the information itself.

C#

page.Text = "The report covers 1,284 orders. Read the <a href=\"formats\">format notes</a> first.";
page.EnableLinks = true;
page.LinkClicked += (s, e) => {
    if (e.LinkHref == "formats")
        ShowFormatNotes();
};

VB

page.Text = "The report covers 1,284 orders. Read the <a href=""formats"">format notes</a> first."
page.EnableLinks = True
AddHandler page.LinkClicked, Sub(s, e)
    If e.LinkHref = "formats" Then ShowFormatNotes()
End Sub

Every element has an SftTaskDialogControl.Tag property for the application's own data.