### Build and Run PleasantUI Example App Source: https://github.com/onebeld/pleasantui/blob/main/samples/PleasantUI.Example/README.md Commands to build the entire PleasantUI solution and run the example application from the repository root. Ensure .NET 9.0 SDK and Avalonia 12.0 are installed. ```bash # Navigate to the PleasantUI repository root cd PleasantUI # Build the entire solution dotnet build # Run the example app dotnet run --project samples/PleasantUI.Example/PleasantUI.Example.csproj ``` -------------------------------- ### Basic InstallWizard Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/InstallWizard.md Defines a multi-step installation wizard with three steps: Welcome, License, and Install. Each step has a header and content. ```xml ``` -------------------------------- ### Full TerminalPanel Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/TerminalPanel.md A comprehensive example demonstrating the initialization and command handling of a TerminalPanel. ```csharp var terminal = new TerminalPanel { Title = "Command Line", Prompt = ">", IsRunning = true }; terminal.CommandSubmitted += (sender, cmd) => { terminal.AppendOutput($"{terminal.Prompt} {cmd}\n"); switch (cmd.ToLower()) { case "help": terminal.AppendOutput("Available commands: help, clear, echo [text]\n"); break; case "clear": terminal.ClearOutput(); break; default: terminal.AppendOutput($"Unknown command: {cmd}\n"); break; } }; ``` -------------------------------- ### StepDialog Full Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/StepDialog.md A comprehensive example showing the initialization and usage of StepDialog with various properties and event handling. ```APIDOC ## StepDialog Full Example ### Description This example provides a complete illustration of creating, configuring, and displaying a `StepDialog` with multiple steps and event handling. ### Method N/A (UI Component) ### Endpoint N/A (UI Component) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```csharp var dialog = new StepDialog { Title = "Installation Wizard", Description = "Complete these steps to install the application", PrimaryButtonText = "Next", SecondaryButtonText = "Cancel" }; dialog.Steps.Add(new StepItem { Title = "Welcome", Description = "Introduction" }); dialog.Steps.Add(new StepItem { Title = "License", Description = "Accept terms" }); dialog.Steps.Add(new StepItem { Title = "Install", Description = "Install files" }); dialog.PrimaryButtonClicked += (sender, e) => { // Handle next step }; await dialog.ShowAsync(window); ``` ### Response #### Success Response (200) N/A (UI Component) #### Response Example N/A ``` -------------------------------- ### VirtualizingWrapPanel Example with Images Source: https://github.com/onebeld/pleasantui/blob/main/docs/VirtualizingWrapPanel.md An example demonstrating VirtualizingWrapPanel with fixed item sizes for displaying a collection of images. This configuration is suitable for visual content. ```xml ``` -------------------------------- ### Complete StepDialog Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/StepDialog.md This comprehensive example demonstrates initializing a StepDialog with properties, adding steps programmatically, and attaching event handlers for button clicks, followed by showing the dialog. ```csharp var dialog = new StepDialog { Title = "Installation Wizard", Description = "Complete these steps to install the application", PrimaryButtonText = "Next", SecondaryButtonText = "Cancel" }; dialog.Steps.Add(new StepItem { Title = "Welcome", Description = "Introduction" }); dialog.Steps.Add(new StepItem { Title = "License", Description = "Accept terms" }); dialog.Steps.Add(new StepItem { Title = "Install", Description = "Install files" }); dialog.PrimaryButtonClicked += (sender, e) => { // Handle next step }; await dialog.ShowAsync(window); ``` -------------------------------- ### LogViewerPanel Copy Handling and Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/LogViewerPanel.md Provides code examples for handling copy requests for individual entries or all entries, and a complete ViewModel example demonstrating LogViewerPanel integration. ```APIDOC ### Copy Handling Handle copy requests: ```csharp logViewerPanel.CopyAllRequested += (sender, e) => { var text = string.Join("\n", logViewerPanel.FilteredEntries.Select(x => x.ToString())); Clipboard.SetTextAsync(text); }; logViewerPanel.CopyEntryRequested += (sender, entry) => { Clipboard.SetTextAsync(entry.ToString()); }; ``` ### Example ```csharp // In your ViewModel public class MainViewModel { public LogViewerPanel LogViewer { get; } = new LogViewerPanel { Title = "Application Logs", MaxEntries = 10000 }; private void LogOperation(string message, LogLevel level = LogLevel.Information) { LogViewer.Append(level, message, Source: "MainViewModel"); } } ``` ``` -------------------------------- ### Complex DashboardCard Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/DashboardCard.md An advanced example combining header, subtitle, toolbar items, content, and footer. ```xml ``` -------------------------------- ### NavigationView Basic Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/NavigationView.md Demonstrates the basic setup of a NavigationView with left-aligned items. ```APIDOC ## NavigationView Basic Usage ### Description This example shows a basic NavigationView with items positioned on the left. Each `NavigationViewItem` has a header, icon, title, and content associated with it. ### Method N/A (UI Component Configuration) ### Endpoint N/A (UI Component Configuration) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```xml ``` ### Response N/A (UI Component Configuration) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### ViewModel Integration Example for LogViewerPanel Source: https://github.com/onebeld/pleasantui/blob/main/docs/LogViewerPanel.md Shows how to integrate a LogViewerPanel instance within a ViewModel, including appending entries. ```csharp // In your ViewModel public class MainViewModel { public LogViewerPanel LogViewer { get; } = new LogViewerPanel { Title = "Application Logs", MaxEntries = 10000 }; private void LogOperation(string message, LogLevel level = LogLevel.Information) { LogViewer.Append(level, message, Source: "MainViewModel"); } } ``` -------------------------------- ### ProgressRing Sizes Source: https://github.com/onebeld/pleasantui/blob/main/docs/ProgressRing.md Examples of how to adjust the size of the ProgressRing for different use cases. ```APIDOC ## ProgressRing Sizes ### Description This section provides examples of how to set different sizes for the `ProgressRing` component, suitable for various UI contexts from small inline indicators to larger hero elements. ### Method N/A (UI Component) ### Endpoint N/A (UI Component) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```xml ``` ### Response N/A (UI Component) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Data-bound List Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/SelectionList.md Shows how to bind data to the SelectionList using `ItemsSource` and member bindings. ```APIDOC ## Data-bound List ```xml ``` ``` -------------------------------- ### Install PleasantUI DataGrid Package Source: https://github.com/onebeld/pleasantui/blob/main/docs/DataGrid.md Add this NuGet package reference to your project to include the PleasantUI DataGrid functionality. ```xml ``` -------------------------------- ### DataGrid Usage Example Source: https://context7.com/onebeld/pleasantui/llms.txt Demonstrates how to use the DataGrid component with custom columns and row details template. Configure properties like ItemsSource, AutoGenerateColumns, and SelectionMode as needed. ```xml ``` -------------------------------- ### Searching and Filtering Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/ItemListPanel.md Demonstrates how to use the search functionality, including setting the search watermark and programmatically controlling the search text. ```APIDOC ## Searching and filtering The panel includes a search box that filters items in real-time: ```xml ``` ```csharp // Set search text programmatically itemListPanel.SearchText = "search term"; // Clear search itemListPanel.ClearSearch(); ``` ``` -------------------------------- ### Create a New Page Implementing IPage Source: https://github.com/onebeld/pleasantui/blob/main/samples/PleasantUI.Example/README.md Implement the IPage interface and InitializeComponent() in your custom page class. This example shows a basic structure for a new page. ```csharp public class MyPage : UserControl, IPage { public MyPage() { InitializeComponent(); } } ``` -------------------------------- ### Footer Content Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/ItemListPanel.md Shows how to add custom content to the footer slot, such as pagination controls. ```APIDOC ## Footer content Add a footer for pagination or other controls: ```xml ``` -------------------------------- ### Styling ProgressRing Source: https://github.com/onebeld/pleasantui/blob/main/docs/ProgressRing.md Provides an example of how to override the default styling of the ProgressRing using standard property setters for Foreground and Background. ```xml ``` -------------------------------- ### Create Custom Theme Programmatically Source: https://github.com/onebeld/pleasantui/blob/main/docs/ThemeEngine.md Create a new custom theme by programmatically defining its colors. Start with a template dictionary, override specific colors like 'AccentColor', and then add it to PleasantTheme.CustomThemes. ```csharp var colors = PleasantTheme.GetThemeTemplateDictionary(); // start from Light colors["AccentColor"] = Color.Parse("#FF6B35"); // override accent var custom = new CustomTheme { Name = "My Theme", Colors = colors.ToColorPalette() }; PleasantTheme.CustomThemes.Add(custom); PleasantTheme.SelectedCustomTheme = custom; ``` -------------------------------- ### Dynamic Tab Management with C# Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantTabView.md Provides C# code examples for dynamically managing tabs, including adding new tabs and handling tab closing events. ```APIDOC ## Dynamic Tab Management ```csharp // Add a tab when + is clicked tabView.ClickOnAddingButton += (_, _) => { tabView.Items.Add(new PleasantTabItem { Header = $"Tab {tabView.Items.Count + 1}", Content = new MyTabContent() }); }; // Prevent closing a specific tab tab.Closing += (_, e) => { if (HasUnsavedChanges()) e.Handled = true; // cancel close }; ``` ## Programmatic Close ```csharp tab.CloseCore(); // removes the tab from its parent PleasantTabView ``` ``` -------------------------------- ### InstallWizard Basic Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/InstallWizard.md Demonstrates the basic structure and usage of the InstallWizard component with multiple WizardStep instances. ```APIDOC ## InstallWizard Basic Usage ### Description This section shows how to define an `InstallWizard` with several `WizardStep` components, including their headers, descriptions, and content. ### Method Not Applicable (UI Component Definition) ### Endpoint Not Applicable (UI Component Definition) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```xml ``` ### Response #### Success Response (200) Not Applicable (UI Component Definition) #### Response Example None ``` -------------------------------- ### Basic ItemListPanel Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/ItemListPanel.md Demonstrates the fundamental setup of an ItemListPanel by binding its ItemsSource and ItemTemplate, and enabling two-way data binding for SearchText. ```xml ``` -------------------------------- ### Install PleasantUI Packages Source: https://github.com/onebeld/pleasantui/blob/main/README.md Add these PackageReference elements to your project file to include PleasantUI components. Ensure you are using the correct version for your Avalonia framework. ```xml ``` -------------------------------- ### Copy Project Directory Source: https://github.com/onebeld/pleasantui/blob/main/samples/PleasantUI.Example/README.md Use the xcopy command to copy the example application directory to a new location for your real-world application. Ensure to use the /E and /I flags for copying subdirectories and creating the destination directory if it doesn't exist. ```bash # Copy the example app to your new project location xcopy /E /I PleasantUI.Example AutoparkERP # Navigate to the new project cd AutoparkERP # Rename files ren PleasantUI.Example.csproj AutoparkERP.csproj ren PleasantUiExampleApp.cs AutoparkERPApp.cs ``` -------------------------------- ### Custom Arc Range for ProgressRing Source: https://github.com/onebeld/pleasantui/blob/main/docs/ProgressRing.md Demonstrates how to create a partial ring by specifying custom StartAngle and EndAngle values. This example shows the bottom half of the ring. ```xml ``` -------------------------------- ### InstallWizard Programmatic Navigation Source: https://github.com/onebeld/pleasantui/blob/main/docs/InstallWizard.md Demonstrates how to control the wizard's steps programmatically. ```APIDOC ## Programmatic Navigation ### Description Provides examples of navigating between wizard steps using code, including advancing, going back, and jumping to a specific step. ### Method `wizard.GoNext()`, `wizard.GoBack()`, `wizard.CurrentStepIndex` assignment ### Endpoint Not Applicable (Method Calls / Property Assignment) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // Advance to the next step wizard.GoNext(); // advance to next step (raises Finished on last step) // Go back to the previous step wizard.GoBack(); // go to previous step // Jump directly to a specific step (e.g., the 3rd step, index 2) wizard.CurrentStepIndex = 2; // jump directly to a step ``` ### Response #### Success Response (200) Not Applicable (Method Return / Property Change) #### Response Example None ``` -------------------------------- ### Custom Dialog Class Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/ContentDialog.md Provides an example of subclassing ContentDialog to create a custom dialog, like a confirmation dialog. ```APIDOC ## Custom Dialog Class ### Description This example shows how to create a custom dialog by subclassing `ContentDialog`. It includes a `ConfirmDialog` class with a static `Show` method for easy instantiation and display, demonstrating how to configure and show the dialog with a result. ### Method C# Class Definition and Method Call ### Endpoint N/A ### Parameters N/A ### Request Example ```csharp public class ConfirmDialog : ContentDialog { public ConfirmDialog() { InitializeComponent(); // wire up buttons } public static async Task Show(IPleasantWindow parent, string message) { var dialog = new ConfirmDialog(); // configure... string? result = await dialog.ShowAsync(parent); return result == "confirmed"; } } ``` ### Response N/A #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### InstallWizard Marking a Step Complete Source: https://github.com/onebeld/pleasantui/blob/main/docs/InstallWizard.md Shows how to manually mark a wizard step as complete and set its completion state. ```APIDOC ## Marking a Step Complete with a State ### Description This example demonstrates how to programmatically mark the current wizard step as completed and assign a specific completion state (e.g., Warning). ### Method `wizard.CurrentStep.IsCompleted` assignment, `wizard.CurrentStep.CompletionState` assignment, `wizard.GoNext()` ### Endpoint Not Applicable (Property Assignment / Method Call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // Mark the current step as completed with a warning state wizard.CurrentStep!.IsCompleted = true; wizard.CurrentStep!.CompletionState = WizardStepCompletionState.Warning; // Then, advance to the next step wizard.GoNext(); ``` ### Response #### Success Response (200) Not Applicable (State Change) #### Response Example None ``` -------------------------------- ### InstallWizard UI Definition Source: https://context7.com/onebeld/pleasantui/llms.txt Define an InstallWizard with a title, icon, footer, and event handlers for completion and cancellation. Steps are defined within InstallWizard.Steps, each with a Header, Description, and Content. ```xml ``` -------------------------------- ### Initialize and Use Localization System Source: https://context7.com/onebeld/pleasantui/llms.txt Register resource managers and set the initial language in the App constructor. Switch languages at runtime and perform lookups with fallback options. ```csharp // Register resource managers in App constructor public App() { Localizer.AddRes(new ResourceManager(typeof(Properties.Localizations.App))); Localizer.AddRes(new ResourceManager(typeof(LibraryStrings))); // multiple files Localizer.ChangeLang("en"); // set initial language } // Switch language at runtime Localizer.ChangeLang("ru"); // Code-behind lookups string text = Localizer.Instance["WelcomeMessage"]; // simple lookup string title = Localizer.TrDefault("DialogTitle", "Confirm"); // safe lookup with fallback string label = Localizer.TrDefault("Save", "Save", "Settings"); // with context string msg = Localizer.Tr("ItemCount", context: null, args: 42); // with format args // Subscribe to language changes Localizer.Instance.LocalizationChanged += lang => { Console.WriteLine($"Language changed to: {lang}"); }; ``` -------------------------------- ### Basic CommandBar Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/CommandBar.md Demonstrates the fundamental structure of a CommandBar with primary and secondary commands. ```xml ``` -------------------------------- ### Complex PleasantDatePicker Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantDatePicker.md An example showcasing multiple PleasantDatePicker instances within a StackPanel, each configured with different watermarks and date range restrictions. This demonstrates practical application in a UI layout. ```xml ``` -------------------------------- ### Initialize Avalonia Application Source: https://context7.com/onebeld/pleasantui/llms.txt Standard Avalonia application initialization, including loading XAML and setting up the main window. Ensure AvaloniaXamlLoader.Load(this) is called. ```csharp public partial class App : Application { public override void Initialize() { AvaloniaXamlLoader.Load(this); // required } public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = new MainWindow { DataContext = new MainWindowViewModel(), }; } base.OnFrameworkInitializationCompleted(); } } ``` -------------------------------- ### Nested PleasantBorder Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantBorder.md Illustrates how PleasantBorder components can be nested to create complex UI structures with distinct elevation levels for each layer. This example shows a window, panel, and card hierarchy. ```xml ``` -------------------------------- ### Programmatic Navigation for InstallWizard Source: https://github.com/onebeld/pleasantui/blob/main/docs/InstallWizard.md Provides methods for controlling the wizard's navigation programmatically, including advancing, going back, or directly jumping to a specific step. ```csharp wizard.GoNext(); // advance to next step (raises Finished on last step) wizard.GoBack(); // go to previous step wizard.CurrentStepIndex = 2; // jump directly to a step ``` -------------------------------- ### Basic LogViewerPanel Usage Source: https://github.com/onebeld/pleasantui/blob/main/docs/LogViewerPanel.md Demonstrates the basic instantiation of the LogViewerPanel with essential properties like IsOpen and Title. ```xml ``` -------------------------------- ### Custom Empty State Example Source: https://github.com/onebeld/pleasantui/blob/main/docs/SelectionList.md Illustrates how to customize the empty state message for the SelectionList. ```APIDOC ## Custom Empty State ```xml ``` ``` -------------------------------- ### PleasantSnackbar With Title Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantSnackbar.md Example of displaying a snackbar with both a title and a message, creating a two-line notification. ```APIDOC ## PleasantSnackbar With Title ### Description Shows a snackbar with a prominent title above the main message, useful for more detailed notifications. ### Method `Show` ### Endpoint N/A (Component Method) ### Parameters See `PleasantSnackbarOptions`. ### Request Example ```csharp PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Your changes have been saved to the cloud.") { Title = "Saved", Icon = MaterialIcons.CloudCheckOutline, NotificationType = NotificationType.Success }); ``` ### Response None (This is a UI component display method) ``` -------------------------------- ### PleasantSnackbar Severity Variants Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantSnackbar.md Examples of using different notification types for visual feedback. ```APIDOC ## PleasantSnackbar Severity Variants ### Description Demonstrates how to display snackbars with different severity levels (Information, Success, Warning, Error) and associated icons. ### Examples #### Information (Default) ```csharp PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Update available.")); ``` #### Success ```csharp PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Saved.") { NotificationType = NotificationType.Success, Icon = MaterialIcons.CheckCircleOutline }); ``` #### Warning ```csharp PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Low disk space.") { NotificationType = NotificationType.Warning, Icon = MaterialIcons.AlertOutline }); ``` #### Error ```csharp PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Upload failed.") { NotificationType = NotificationType.Error, Icon = MaterialIcons.CloseCircleOutline }); ``` ``` -------------------------------- ### Simple Row with OptionsDisplayItem Source: https://context7.com/onebeld/pleasantui/llms.txt Create a basic settings row with a header, description, and icon using OptionsDisplayItem. ```xml ``` -------------------------------- ### Tray Icon Integration with PleasantTrayPopup Source: https://github.com/onebeld/pleasantui/blob/main/docs/PleasantTrayPopup.md Provides an example of integrating PleasantTrayPopup with a system tray icon. ```APIDOC ## Tray Icon Integration ### Description This example demonstrates how to integrate PleasantTrayPopup with a system tray icon to show/hide the popup on icon click. ### Method Event handling and method invocation ### Endpoint N/A (Client-side component) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp TrayIcon trayIcon = new TrayIcon(); PleasantTrayPopup? popup = null; trayIcon.Clicked += (_, _) => { if (popup is { IsVisible: true }) { popup.Dismiss(); return; } // Assuming MyTrayPopup is a derived class or configured PleasantTrayPopup popup = new MyTrayPopup(); popup.Dismissed += (_, _) => popup = null; popup.ShowNearTray(); }; ``` ### Response #### Success Response (200) N/A (Client-side component) #### Response Example None ``` -------------------------------- ### InstallWizard Modal and Window Display Source: https://context7.com/onebeld/pleasantui/llms.txt Show the InstallWizard as a modal dialog or a standalone window. The ShowAsModalAsync method returns a boolean indicating if the wizard was finished. ```csharp // Show as modal dialog bool finished = await InstallWizard.ShowAsModalAsync(wizard, this); if (finished) CompleteInstallation(); // Show as standalone window bool finished = await InstallWizard.ShowAsWindowAsync(wizard, owner: this, width: 760, height: 500); ```