Dialogs #46
JordanMarr
started this conversation in
General
Dialogs
#46
Replies: 3 comments 4 replies
-
I think that's a great idea. Have you looked at FluentAvalonia? They have a range of dialogs - of course I'm already nibbling around the edges with it - so I'm a bit "vested" in it already. 😸 |
Beta Was this translation helpful? Give feedback.
1 reply
-
Nice! I have been pondering best way to do those light weight interactions. I don’t want to build a whole new variety for a simple interaction. The modal widget in silverlight was really helpful back in the day but hadn’t seen an avalonia equivalent. Am 1/6/24 um 10:37 AM schrieb Houston Haynes ***@***.***>:
<!-- TaskDialog can be declared in Xaml -->
<!-- However, it must still be launched in C# -->
<ui:TaskDialog Name="TaskDialog1"
Title="FluentAvalonia"
Header="Header Here"
SubHeader="SubHeader"
Content="This is some sample text, but you can put more advanced content here if you like"
FooterVisibility="Always"
IsFooterExpanded="False"
ShowProgressBar="False">
<ui:TaskDialog.Commands>
<ui:TaskDialogCommand Text="Sample Command"
Description="This is a description of the Sample Command"
IsEnabled="True"
DialogResult="CommandResult"/>
</ui:TaskDialog.Commands>
<ui:TaskDialog.Buttons>
<ui:TaskDialogButton Text="OK" DialogResult="OK" />
<ui:TaskDialogButton Text="Cancel" DialogResult="Cancel" />
</ui:TaskDialog.Buttons>
<ui:TaskDialog.Footer>
<CheckBox Content="Never show me this again" />
</ui:TaskDialog.Footer>
</ui:TaskDialog>
// If your TaskDialog is declared in Xaml, just reference it and call ShowAsync()
// TaskDialog can launch in either windowed or hosted mode. Windowed mode presents the dialog in a
// top level window (using CoreWindow), thus it has a titlebar and an additional property Title
// Hosted mode uses the OverlayLayer.
this.FindControl<TaskDialog>("TaskDialog1").ShowAsync();
// Declaring a TaskDialog from C#:
var td = new TaskDialog
{
// Title property only applies on Windowed dialogs
Title = "FluentAvalonia",
Header = "Header",
Subheader = "Subheader",
Content = "This is some sample text, but you can put more advanced content here if you like",
IconSource = new SymbolIconSource { Symbol = Symbol.Save },
FooterVisibility = TaskDialogFooterVisibility.Auto,
Footer = new CheckBox { Content = "Never show me this again" },
Commands =
{
new TaskDialogCommand
{
Text = "Command Text",
Description = "Description",
DialogResult = "CommandResult",
// ClosesOnInvoked property lets you choose if invoking this command closes the dialog
// automatically (default true)
ClosesOnInvoked = true,
// Can also set IconSource
// Can also set IsEnabled
}
},
Buttons =
{
// For more advanced scenarios, you can create your own buttons
// Custom buttons allow you to attach icons, custom results,
// command and click handlers to fully customize your experience
// Note: 'null' is not a valid dialog result and is automatically
// converted to TaskDialogStandardResult.None when the dialog closes
new TaskDialogButton("OK" /* text */, "myResult" /* dialogResult */)
// There are some default buttons for simple cases provided
// These have predefinded text and results that correspond to
// TaskDialogStandardResult enum
// Note that built in buttons cannot have Commands, Icons, or
// click handlers attached to them
TaskDialogButton.OKButton,
TaskDialogButton.CancelButton,
TaskDialogButton.YesButton,
TaskDialogButton.NoButton,
TaskDialogButton.RetryButton,
TaskDialogButton.CloseButton
}
};
// Before showing a dialog declared in C#, you MUST set the XamlRoot property
// Using the VisualRoot is fine, if the VisualRoot is a Window, the dialog automatically launches in
// Windowed mode, otherwise, it tries to find the OverlayLayer and will launch in hosted mode
// If your TaskDialog is declared in Xaml, this is automatically handled for you
td.XamlRoot = this.VisualRoot;
var result = await td.ShowAsync();
// If you want to force hosted mode, ShowAsync accepts a parameter 'showHosted' to force this mode
var result = await td.ShowAsync(true);
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Those look great. Considering how nice the hamburger navigation menu is, it makes sense to also utilize the Fluent Avalonia dialogs. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Making a note here to try out this library for creating embedded dialogs that looks very nice:
https://github.com/AvaloniaUtils/DialogHost.Avalonia
Beta Was this translation helpful? Give feedback.
All reactions