Posted 2 months ago by Grzegorz Z
Avatar

I would like to place buttons in my window that look like the OK/Cancel buttons displayed using UserPromptBuilder.WithStandardButtons. How can I achieve this?

Comments (4)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The buttons themselves use our default Outline theme.  You can find more details about our native control themes here:

https://www.actiprosoftware.com/docs/controls/avalonia/themes/native-control-themes

As for the rest of the layout, you could achieve a similar layout as the button tray in our UserPromptControl by using a Border control to define the background color and horizontal dividing line.  Then place the buttons in a horizontal StackPanel that is right-aligned with Spacing defined to add space between the buttons.

If I misunderstood your question, please reply with more detail about exactly what part of the look you are trying to achieve.


Actipro Software Support

Posted 2 months ago by Grzegorz Z
Avatar

Of course, I can replicate the button layout similar to that in UserPromptControl myself. However, I was wondering if it might be possible to use the UserPromptButtonItemsControl component and pass it the MessageBoxButtons variable to achieve exactly the same layout as in UserPromptControl?

Answer - Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The logic to take the flags enum MessageBoxButtons and break that out into individual values is internal to UserPromptControl and not part of the UserPromptButtonItemsControl.  There's little value in using UserPromptButtonItemsControl on its own since you could just use a StackPanel or WrapPanel instead.

UserPromptControl uses a WrapPanel with MinWidth on each button (to avoid really small buttons for labels like 'OK') and our UserPromptUIButtonTextConverter to convert the enum values into their corresponding string content based on our localizable resources.

Having a "button tray" control for use outside of UserPromptControl would be useful, though, so we've made a note about considering that for a future release.


Actipro Software Support

Posted 2 months ago by Grzegorz Z
Avatar

Ok, thank you for the clarifications.

Add Comment

Please log in to a validated account to post comments.