UserPromptControl Class
Represents a prompt displayed to a user with an option to respond.
[TemplatePart(Name = "PART_ButtonItemsControl", Type = typeof(UserPromptButtonItemsControl))]
public class UserPromptControl : HeaderedContentControl
- Inheritance:
- object Visual UIElement FrameworkElement Control ContentControl HeaderedContentControl object
Constructors
UserPromptControl()
Initializes an instance of the class.
public UserPromptControl()
Properties
ButtonItems
The items which define the buttons to be presented on the prompt.
public IEnumerable? ButtonItems { get; set; }
Property Value
- IEnumerable:
An enumerable of objects which represent buttons. When
null, the value of StandardButtons will define which button items are presented.
See Also
ButtonItemsClipboardText
The text used to represent the ButtonItems when copied to the clipboard.
public string? ButtonItemsClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the individual items of ButtonItems; e.g., button labels will be used as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
ButtonItemsHorizontalAlignment
The horizontal alignment for the panel of ButtonItems.
public HorizontalAlignment ButtonItemsHorizontalAlignment { get; set; }
Property Value
- HorizontalAlignment:
The default value is Right.
ButtonStyle
The Style applied to buttons.
CanExpand
Indicates whether content can be expanded, typically showing the ExpandedInformationContent.
public bool CanExpand { get; }
Property Value
- bool:
trueif expansion is available; otherwise,false.
CheckBoxContent
The content for the checkbox.
public object? CheckBoxContent { get; set; }
Property Value
Remarks
The default template will only display the check box if this property is populated.
See Also
CheckBoxContentClipboardText
The text used to represent the CheckBoxContent when copied to the clipboard.
public string? CheckBoxContentClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the CheckBoxContent; e.g., string-based content will be used directly as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
CheckBoxContentStringFormat
The format used to display the CheckBoxContent content as a string. This arises only when no template is available.
CheckBoxContentTemplate
The template used to display the CheckBoxContent.
CheckBoxContentTemplateSelector
The DataTemplateSelector to use for CheckBoxContent.
public DataTemplateSelector? CheckBoxContentTemplateSelector { get; set; }
Property Value
CloseResult
The result for the prompt if it is closed without an explicit response.
public UserPromptStandardResult? CloseResult { get; set; }
Property Value
- UserPromptStandardResult?:
One of the UserPromptStandardResult values, or
nullif an explicit result has not been defined and could not be inferred from StandardButtons. The default value isnull.
ContentClipboardText
The text used to represent the Content when copied to the clipboard.
public string? ContentClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the Content; e.g., string-based content will be used directly as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
ContentMaxHeight
The maximum height constraint of the Content
[TypeConverter(typeof(LengthConverter))]
public double ContentMaxHeight { get; set; }
Property Value
- double:
The default value is PositiveInfinity.
Remarks
The maximum height of the content, in device-independent units (1/96th inch per unit). The default value is PositiveInfinity. This value can be any value equal to or greater than 0.0. PositiveInfinity is also valid.
ContentMaxWidth
The maximum width constraint of the Content
[TypeConverter(typeof(LengthConverter))]
public double ContentMaxWidth { get; set; }
Property Value
- double:
The default value is PositiveInfinity.
Remarks
The maximum width of the content, in device-independent units (1/96th inch per unit). The default value is PositiveInfinity. This value can be any value equal to or greater than 0.0. PositiveInfinity is also valid.
CornerRadius
The CornerRadius applied to the control.
DefaultResult
The default result for the prompt.
ExpandedInformationCollapsedHeaderText
The text displayed as the header for ExpandedInformationContent
when IsExpanded is false.
public string? ExpandedInformationCollapsedHeaderText { get; set; }
Property Value
Remarks
Text supports access keys.
See Also
ExpandedInformationContent
The content for the expanded information.
ExpandedInformationContentClipboardText
The text used to represent the ExpandedInformationContent when copied to the clipboard.
public string? ExpandedInformationContentClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the ExpandedInformationContent; e.g., string-based content will be used directly as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
ExpandedInformationContentStringFormat
The format used to display the ExpandedInformationContent content as a string. This arises only when no template is available.
ExpandedInformationContentTemplate
The template used to display the ExpandedInformationContent.
ExpandedInformationContentTemplateSelector
The DataTemplateSelector to use for ExpandedInformationContent.
public DataTemplateSelector? ExpandedInformationContentTemplateSelector { get; set; }
Property Value
ExpandedInformationExpandedHeaderText
The text displayed as the header for ExpandedInformationContent
when IsExpanded is true.
public string? ExpandedInformationExpandedHeaderText { get; set; }
Property Value
Remarks
Text supports access keys.
See Also
Footer
The content for the footer.
FooterClipboardText
The text used to represent the Footer when copied to the clipboard.
public string? FooterClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the Footer; e.g., string-based content will be used directly as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
FooterImageSource
The source of an image to be displayed in the footer.
FooterStringFormat
The format used to display the Footer content as a string. This arises only when no template is available.
FooterTemplate
The template used to display the Footer.
FooterTemplateSelector
The DataTemplateSelector to use for the Footer.
public DataTemplateSelector? FooterTemplateSelector { get; set; }
Property Value
HasAlignedHeader
Indicates whether the status image and header are aligned.
public bool HasAlignedHeader { get; }
Property Value
- bool:
trueif status image and header are aligned; otherwise,false. The default value isfalse.
HasCheckBoxContent
Indicates whether CheckBoxContent has a non-null value.
public bool HasCheckBoxContent { get; }
Property Value
- bool:
trueif CheckBoxContent has a non-null value; otherwise,false. The default value isfalse.
HasExpandedInformationContent
Indicates whether ExpandedInformationContent has a non-null value.
public bool HasExpandedInformationContent { get; }
Property Value
- bool:
trueif ExpandedInformationContent has a non-null value; otherwise,false. The default value isfalse.
HasFooter
Indicates whether Footer has a non-null value.
public bool HasFooter { get; }
Property Value
HasFooterImage
Indicates whether FooterImageSource has a non-null value.
public bool HasFooterImage { get; }
Property Value
- bool:
trueif FooterImageSource has a non-null value; otherwise,false. The default value isfalse.
HasStatusImage
Indicates whether StatusImageSource has a non-null value.
public bool HasStatusImage { get; }
Property Value
- bool:
trueif StatusImageSource has a non-null value; otherwise,false. The default value isfalse.
HeaderBackground
The brush used for the background of the header.
HeaderBorderBrush
The brush used for the border of the header.
HeaderBorderThickness
The thickness of header border.
HeaderClipboardText
The text used to represent the Header when copied to the clipboard.
public string? HeaderClipboardText { get; set; }
Property Value
- string:
The default value is
null. Whennull, an attempt will be made to resolve the text from the Header; e.g., string-based content will be used directly as the clipboard text.
Remarks
Set this value when the appropriate clipboard text cannot be automatically resolved.
HeaderFontSize
The size of the font used for the header.
HeaderForeground
The brush used for the header.
HelpCommand
The command associated with the Help button.
public ICommand? HelpCommand { get; set; }
Property Value
See Also
HelpCommandParameter
The parameter passed to the HelpCommand.
HorizontalScrollBarVisibility
Indicates whether a horizontal scrollbar is shown for the content.
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
Property Value
- ScrollBarVisibility:
The default value is Disabled.
See Also
IsAnimationEnabled
Indicates whether animations are enabled for an element, when supported.
public bool IsAnimationEnabled { get; set; }
Property Value
- bool:
trueif animations are enabled; otherwise,false. The default value istrue.
Remarks
This property is ignored when the current environment does not support animation.
IsChecked
Indicates whether CheckBoxContent is checked.
public bool IsChecked { get; set; }
Property Value
- bool:
trueif CheckBoxContent is checked; otherwise,false.
See Also
IsExpanded
Indicates whether ExpandedInformationContent is expanded.
public bool IsExpanded { get; set; }
Property Value
- bool:
trueif ExpandedInformationContent is expanded; otherwise,false.
Result
The explicit result for the prompt.
public object? Result { get; set; }
Property Value
- object:
One of the UserPromptStandardResult values,
null, or any object which represents a custom result. When defined for a button that is invoked for the response, the result will be based on the ButtonResultProperty attached property. Otherwise for custom buttons, the result must be manually assigned. The value isnullif a result has not been provided.
StandardButtons
A standard button combination for the user prompt.
public UserPromptStandardButtons StandardButtons { get; set; }
Property Value
- UserPromptStandardButtons:
The default value is OK.
Remarks
This property is ignored when ButtonItems is explicitly defined.
See Also
StandardStatusImage
A standard status image for the user prompt.
public UserPromptStandardImage StandardStatusImage { get; set; }
Property Value
- UserPromptStandardImage:
The default value is None.
Remarks
This property is ignored when StatusImageSource is explicitly defined.
See Also
StatusImageSource
The source of the status image.
public ImageSource? StatusImageSource { get; set; }
Property Value
See Also
SystemSound
The SystemSound to be played when the prompt is displayed.
public SystemSound? SystemSound { get; set; }
Property Value
- SystemSound:
A SystemSound or
nullif a default sound should be played based on the current value of StandardStatusImage. The default value isnull.
TrayBackground
The background brush used for the tray elements.
TrayForeground
The foreground brush used for the tray elements.
VerticalScrollBarVisibility
Indicates whether a vertical scrollbar is shown for the content.
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Property Value
- ScrollBarVisibility:
The default value is Auto.
See Also
Methods
GetButtonClipboardText(DependencyObject)
Gets the value of the ButtonClipboardText attached property for the specified object.
[AttachedPropertyBrowsableForChildren(IncludeDescendants = true)]
public static string? GetButtonClipboardText(DependencyObject obj)
| Parameter | Type | Description |
|---|---|---|
| obj | DependencyObject | The object from which the property value is read. |
Returns
- string:
The object's value.
See Also
GetButtonResult(DependencyObject)
Gets the value of the ButtonResult attached property for the specified object.
[AttachedPropertyBrowsableForChildren(IncludeDescendants = true)]
public static UserPromptStandardResult GetButtonResult(DependencyObject obj)
| Parameter | Type | Description |
|---|---|---|
| obj | DependencyObject | The object from which the property value is read. |
Returns
- UserPromptStandardResult:
The object's value.
See Also
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Creates an appropriate UserPromptControlAutomationPeer for this control.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
A new instance of UserPromptControlAutomationPeer.
SetButtonClipboardText(DependencyObject, string?)
Sets the value of the ButtonClipboardText attached property to the specified object.
public static void SetButtonClipboardText(DependencyObject obj, string? value)
| Parameter | Type | Description |
|---|---|---|
| obj | DependencyObject | The object to which the attached property is written. |
| value | string | The value to set. |
See Also
SetButtonResult(DependencyObject, UserPromptStandardResult)
Sets the value of the ButtonResult attached property to the specified object.
public static void SetButtonResult(DependencyObject obj, UserPromptStandardResult value)
| Parameter | Type | Description |
|---|---|---|
| obj | DependencyObject | The object to which the attached property is written. |
| value | UserPromptStandardResult | The value to set. |
See Also
Events
Responding
Occurs when a response is being submitted to the user prompt.
public event EventHandler<UserPromptResponseEventArgs>? Responding
Event Type
Fields
ButtonClipboardTextProperty
Defines the ButtonClipboardText property.
public static readonly DependencyProperty ButtonClipboardTextProperty
ButtonItemsClipboardTextProperty
Defines the ButtonItemsClipboardText property.
public static readonly DependencyProperty ButtonItemsClipboardTextProperty
ButtonItemsHorizontalAlignmentProperty
Defines the ButtonItemsHorizontalAlignment property.
public static readonly DependencyProperty ButtonItemsHorizontalAlignmentProperty
ButtonItemsProperty
Defines the ButtonItems property.
public static readonly DependencyProperty ButtonItemsProperty
ButtonResultProperty
Defines the ButtonResult property.
public static readonly DependencyProperty ButtonResultProperty
ButtonStyleProperty
Defines the ButtonStyle property.
public static readonly DependencyProperty ButtonStyleProperty
CanExpandProperty
Defines the CanExpand property.
public static readonly DependencyProperty CanExpandProperty
CheckBoxContentClipboardTextProperty
Defines the CheckBoxContentClipboardText property.
public static readonly DependencyProperty CheckBoxContentClipboardTextProperty
CheckBoxContentProperty
Defines the CheckBoxContent property.
public static readonly DependencyProperty CheckBoxContentProperty
CheckBoxContentStringFormatProperty
Defines the CheckBoxContentStringFormat property.
public static readonly DependencyProperty CheckBoxContentStringFormatProperty
CheckBoxContentTemplateProperty
Defines the CheckBoxContentTemplate property.
public static readonly DependencyProperty CheckBoxContentTemplateProperty
CheckBoxContentTemplateSelectorProperty
Defines the CheckBoxContentTemplateSelector property.
public static readonly DependencyProperty CheckBoxContentTemplateSelectorProperty
CloseResultProperty
Defines the CloseResult property.
public static readonly DependencyProperty CloseResultProperty
ContentClipboardTextProperty
Defines the ContentClipboardText property.
public static readonly DependencyProperty ContentClipboardTextProperty
ContentMaxHeightProperty
Defines the ContentMaxHeight property.
public static readonly DependencyProperty ContentMaxHeightProperty
ContentMaxWidthProperty
Defines the ContentMaxWidth property.
public static readonly DependencyProperty ContentMaxWidthProperty
CornerRadiusProperty
Defines the CornerRadius property.
public static readonly DependencyProperty CornerRadiusProperty
DefaultResultProperty
Defines the DefaultResult property.
public static readonly DependencyProperty DefaultResultProperty
ExpandedInformationCollapsedHeaderTextProperty
Defines the ExpandedInformationCollapsedHeaderText property.
public static readonly DependencyProperty ExpandedInformationCollapsedHeaderTextProperty
ExpandedInformationContentClipboardTextProperty
Defines the ExpandedInformationContentClipboardText property.
public static readonly DependencyProperty ExpandedInformationContentClipboardTextProperty
ExpandedInformationContentProperty
Defines the ExpandedInformationContent property.
public static readonly DependencyProperty ExpandedInformationContentProperty
ExpandedInformationContentStringFormatProperty
Defines the ExpandedInformationContentStringFormat property.
public static readonly DependencyProperty ExpandedInformationContentStringFormatProperty
ExpandedInformationContentTemplateProperty
Defines the ExpandedInformationContentTemplate property.
public static readonly DependencyProperty ExpandedInformationContentTemplateProperty
ExpandedInformationContentTemplateSelectorProperty
Defines the ExpandedInformationContentTemplateSelector property.
public static readonly DependencyProperty ExpandedInformationContentTemplateSelectorProperty
ExpandedInformationExpandedHeaderTextProperty
Defines the ExpandedInformationExpandedHeaderText property.
public static readonly DependencyProperty ExpandedInformationExpandedHeaderTextProperty
FooterClipboardTextProperty
Defines the FooterClipboardText property.
public static readonly DependencyProperty FooterClipboardTextProperty
FooterImageSourceProperty
Defines the FooterImageSource property.
public static readonly DependencyProperty FooterImageSourceProperty
FooterProperty
Defines the Footer property.
public static readonly DependencyProperty FooterProperty
FooterStringFormatProperty
Defines the FooterStringFormat property.
public static readonly DependencyProperty FooterStringFormatProperty
FooterTemplateProperty
Defines the FooterTemplate property.
public static readonly DependencyProperty FooterTemplateProperty
FooterTemplateSelectorProperty
Defines the FooterTemplateSelector property.
public static readonly DependencyProperty FooterTemplateSelectorProperty
HasAlignedHeaderProperty
Defines the HasAlignedHeader property.
public static readonly DependencyProperty HasAlignedHeaderProperty
HasCheckBoxContentProperty
Defines the HasCheckBoxContent property.
public static readonly DependencyProperty HasCheckBoxContentProperty
HasExpandedInformationContentProperty
Defines the HasExpandedInformationContent property.
public static readonly DependencyProperty HasExpandedInformationContentProperty
HasFooterImageProperty
Defines the HasFooterImage property.
public static readonly DependencyProperty HasFooterImageProperty
HasFooterProperty
Defines the HasFooter property.
public static readonly DependencyProperty HasFooterProperty
HasStatusImageProperty
Defines the HasStatusImage property.
public static readonly DependencyProperty HasStatusImageProperty
HeaderBackgroundProperty
Defines the HeaderBackground property.
public static readonly DependencyProperty HeaderBackgroundProperty
HeaderBorderBrushProperty
Defines the HeaderBorderBrush property.
public static readonly DependencyProperty HeaderBorderBrushProperty
HeaderBorderThicknessProperty
Defines the HeaderBorderThickness property.
public static readonly DependencyProperty HeaderBorderThicknessProperty
HeaderClipboardTextProperty
Defines the HeaderClipboardText property.
public static readonly DependencyProperty HeaderClipboardTextProperty
HeaderFontSizeProperty
Defines the HeaderFontSize property.
public static readonly DependencyProperty HeaderFontSizeProperty
HeaderForegroundProperty
Defines the HeaderForeground property.
public static readonly DependencyProperty HeaderForegroundProperty
HelpCommandParameterProperty
Defines the HelpCommandParameter property.
public static readonly DependencyProperty HelpCommandParameterProperty
HelpCommandProperty
Defines the HelpCommand property.
public static readonly DependencyProperty HelpCommandProperty
HorizontalScrollBarVisibilityProperty
Defines the HorizontalScrollBarVisibility property.
public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty
IsAnimationEnabledProperty
Defines the IsAnimationEnabled property.
public static readonly DependencyProperty IsAnimationEnabledProperty
IsCheckedProperty
Defines the IsChecked property.
public static readonly DependencyProperty IsCheckedProperty
IsExpandedProperty
Defines the IsExpanded property.
public static readonly DependencyProperty IsExpandedProperty
ResultProperty
Defines the Result property.
public static readonly DependencyProperty ResultProperty
StandardButtonsProperty
Defines the StandardButtons property.
public static readonly DependencyProperty StandardButtonsProperty
StandardStatusImageProperty
Defines the StandardStatusImage property.
public static readonly DependencyProperty StandardStatusImageProperty
StatusImageSourceProperty
Defines the StatusImageSource property.
public static readonly DependencyProperty StatusImageSourceProperty
SystemSoundProperty
Defines the SystemSound property.
public static readonly DependencyProperty SystemSoundProperty
TrayBackgroundProperty
Defines the TrayBackground property.
public static readonly DependencyProperty TrayBackgroundProperty
TrayForegroundProperty
Defines the TrayForeground property.
public static readonly DependencyProperty TrayForegroundProperty
VerticalScrollBarVisibilityProperty
Defines the VerticalScrollBarVisibility property.
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty