UserPromptButtonBuilder Class
Defines a builder for configuring and creating Avalonia.Controls.Button instances to be shown on a user prompt.
public sealed class UserPromptButtonBuilder
- Inheritance:
- object object
Properties
Classes
The space-delimited list of classes to be added to the button.
Command
The value to be assigned to Avalonia.Controls.Button.Command.
CommandParameter
The value to be assigned to Avalonia.Controls.Button.CommandParameter.
ContentClipboardText
The value to be assigned to ButtonClipboardTextProperty.
public string? ContentClipboardText { get; }
Property Value
See Also
Instance
The Avalonia.Controls.Button instance that is being configured.
public Button? Instance { get; }
Property Value
- Button
Remarks
This property is not populated until Build(UserPromptBuilder) is initiated.
See Also
IsCancel
The value to be assigned to Avalonia.Controls.Button.IsCancel and, when true
,
indicates the Result of the button should be used as the CloseResult.
IsDefault
The value to be assigned to Avalonia.Controls.Button.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 MessageBoxResult Result { get; }
Property Value
Remarks
This property can also be used to automatically coerce the Avalonia.Controls.Label.
See Also
Theme
The value to be assigned to Avalonia.StyledElement.Theme.
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 Avalonia.Controls.Button based on the current builder configuration.
public Button Build(UserPromptBuilder parent)
Parameter | Type | Description |
---|---|---|
parent | UserPromptBuilder | The parent UserPromptBuilder. |
Returns
- Button:
The Avalonia.Controls.Button created by this builder.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
Configure()
Initializes a new instance of UserPromptButtonBuilder for creating Avalonia.Controls.Button instances.
public static UserPromptButtonBuilder Configure()
Returns
- UserPromptButtonBuilder:
A new instance of UserPromptButtonBuilder.
Configure<TButton>()
Initializes a new instance of UserPromptButtonBuilder for creating Avalonia.Controls.Button instances of type TButton
.
public static UserPromptButtonBuilder Configure<TButton>() where TButton : Button, new()
- Type Parameters:
-
TButton
-The Avalonia.Controls.Button type.
Returns
- UserPromptButtonBuilder:
A new instance of UserPromptButtonBuilder.
Configure<TButton>(Func<TButton>)
Initializes a new instance of UserPromptButtonBuilder for creating Avalonia.Controls.Button instances of type TButton
.
public static UserPromptButtonBuilder Configure<TButton>(Func<TButton> buttonFactory) where TButton : Button
- Type Parameters:
-
TButton
-The Avalonia.Controls.Button type.
Parameter | Type | Description |
---|---|---|
buttonFactory | Func<TButton> | The factory method that will create a new instance of |
Returns
- UserPromptButtonBuilder:
A new instance of UserPromptButtonBuilder.
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
WithClasses(string?)
Sets the space-delimited list of classes to be added to the button.
public UserPromptButtonBuilder WithClasses(string? classes)
Parameter | Type | Description |
---|---|---|
classes | string | The space-delimited list of classes. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
WithCommand(ICommand?, object?)
Sets the command confirmation for the button.
public UserPromptButtonBuilder WithCommand(ICommand? command, object? commandParameter = null)
Parameter | Type | Description |
---|---|---|
command | ICommand | The value to be assigned to Avalonia.Controls.Button.Command. |
commandParameter | object | The value to be assigned to Avalonia.Controls.Button.CommandParameter. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
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 the current Instance. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
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(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(MessageBoxResult)
Sets the Result property value.
public UserPromptButtonBuilder WithResult(MessageBoxResult result)
Parameter | Type | Description |
---|---|---|
result | MessageBoxResult | The result to assign. |
Returns
- UserPromptButtonBuilder:
This builder instance, which can be used for method chaining.
See Also
WithTheme(ControlTheme?)
Sets the Theme property value.
public UserPromptButtonBuilder WithTheme(ControlTheme? theme)
Parameter | Type | Description |
---|---|---|
theme | ControlTheme | The theme 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()