UserPromptButtonBuilder Class
Defines a builder for configuring and creating Button instances to be shown on a user prompt.
public sealed class UserPromptButtonBuilder
- Inheritance:
- object object
Properties
Command
The value to be assigned to Button.Command.
CommandParameter
The value to be assigned to Button.CommandParameter.
public object? CommandParameter { get; }
Property Value
See Also
ContentClipboardText
The value to be assigned to ButtonClipboardTextProperty.
public string? ContentClipboardText { get; }
Property Value
See Also
Instance
The Button instance that is being configured.
public Button? Instance { get; }
Property Value
Remarks
This property is not populated until Build(UserPromptBuilder) is initiated.
See Also
IsCancel
The value to be assigned to IsCancel and, when true,
indicates the Result of the button should be used as the CloseResult.
IsDefault
The value to be assigned to IsDefault and, when true,
indicates the configured Result of the button should be used as the DefaultResult.
Result
The value to be assigned to ButtonResultProperty.
public UserPromptStandardResult Result { get; }
Property Value
Remarks
This property can also be used to coerce the default button content text.
See Also
Methods
AfterBuild(Action<UserPromptButtonBuilder>?)
Registers a delegate to be called after the build is complete.
public UserPromptButtonBuilder AfterBuild(Action<UserPromptButtonBuilder>? callback)
| Parameter | Type | Description |
|---|---|---|
| callback | Action<UserPromptButtonBuilder> | The callback, which will be invoked after any already registered callbacks are invoked. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
AfterInitialize(Action<UserPromptButtonBuilder>?)
Registers a delegate to be called after the Instance is created, but before the build starts.
public UserPromptButtonBuilder AfterInitialize(Action<UserPromptButtonBuilder>? callback)
| Parameter | Type | Description |
|---|---|---|
| callback | Action<UserPromptButtonBuilder> | The callback, which will be invoked after any already registered callbacks are invoked. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
Build(UserPromptBuilder)
Creates and configures a Button based on the current builder configuration.
public Button Build(UserPromptBuilder parent)
| Parameter | Type | Description |
|---|---|---|
| parent | UserPromptBuilder | The parent UserPromptBuilder. |
Returns
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
Configure()
Creates and returns a new instance of UserPromptButtonBuilder for creating Button instances.
Configure<TButton>()
Creates and returns a new instance of UserPromptButtonBuilder for creating Button instances of type TButton.
public static UserPromptButtonBuilder Configure<TButton>() where TButton : Button, new()
- Type Parameters:
-
TButton-The Button type.
Returns
Configure<TButton>(Func<TButton>)
Creates and returns a new instance of UserPromptButtonBuilder for creating Button instances of type TButton.
public static UserPromptButtonBuilder Configure<TButton>(Func<TButton> buttonFactory) where TButton : Button
- Type Parameters:
-
TButton-The Button type.
| Parameter | Type | Description |
|---|---|---|
| buttonFactory | Func<TButton> | The factory method that will create a new instance of |
Returns
UseAsCloseResult()
Sets the IsCancel property value and, when true,
indicates the configured Result of the button should be used as the CloseResult.
public UserPromptButtonBuilder UseAsCloseResult()
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
UseAsDefaultResult()
Sets the IsDefault property value and, when true,
indicates the configured Result of the button should be used as the DefaultResult.
public UserPromptButtonBuilder UseAsDefaultResult()
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
WithCommand(ICommand?, object?)
Sets the command configuration for the button.
public UserPromptButtonBuilder WithCommand(ICommand? command, object? commandParameter = null)
| Parameter | Type | Description |
|---|---|---|
| command | ICommand | The value to be assigned to |
| commandParameter | object | The value to be assigned to |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
WithContent(Func<object?>?)
Sets the content of the button.
public UserPromptButtonBuilder WithContent(Func<object?>? contentFactory)
| Parameter | Type | Description |
|---|---|---|
| contentFactory | Func<object> | The factory method for creating content. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
WithContent(Func<Button, object?>?)
Sets the content of the button.
public UserPromptButtonBuilder WithContent(Func<Button, object?>? contentFactory)
| Parameter | Type | Description |
|---|---|---|
| contentFactory | Func<Button, object> | The factory method for creating content, which also passes a reference to the current Instance. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
WithContent(object?)
Sets the content of the button.
public UserPromptButtonBuilder WithContent(object? content)
| Parameter | Type | Description |
|---|---|---|
| content | object | The content. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
WithContentClipboardText(string?)
Sets the ContentClipboardText property value.
public UserPromptButtonBuilder WithContentClipboardText(string? text)
| Parameter | Type | Description |
|---|---|---|
| text | string | The text. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
WithResult(UserPromptStandardResult)
Sets the Result property value.
public UserPromptButtonBuilder WithResult(UserPromptStandardResult result)
| Parameter | Type | Description |
|---|---|---|
| result | UserPromptStandardResult | The result to assign. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
Inherited Members
- object.GetType()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()