### Navigation Drawer Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/drawer.md Demonstrates a complete example of implementing and displaying a navigation drawer. This includes the ViewModel, View, and usage of `OverlayDrawer.ShowStandard`. ```APIDOC ## Complete Example: Navigation Drawer ### Description Provides a full implementation of a navigation drawer, including its ViewModel, View definition, and how to invoke it using `OverlayDrawer.ShowStandard`. This example showcases a typical use case for side navigation. ### Usage ```csharp // ViewModel public class NavigationViewModel { public List Items { get; } = new() { new NavItem { Title = "Home", Icon = "home" }, new NavItem { Title = "Settings", Icon = "settings" }, new NavItem { Title = "About", Icon = "info" } }; public Action? OnItemSelected { get; set; } } // View public class NavigationView : UserControl { public NavigationView() { var vm = new NavigationViewModel(); DataContext = vm; Content = new StackPanel { Children = { new TextBlock { Text = "Navigation", FontSize = 18, Margin = new Thickness(16) }, new ItemsControl { Items = vm.Items, ItemTemplate = new FuncDataTemplate((item, _) => new Button { Content = item.Title } ) } } }; } } // Invocation OverlayDrawer.ShowStandard( navigationViewModel, hostId: "mainHost", options: new DrawerOptions { Position = Position.Left, CanLightDismiss = true, MinWidth = 250, MaxWidth = 350 } ); ``` ``` -------------------------------- ### DatePicker Initialization Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/date-time-pickers.md Example of how to instantiate and configure a DatePicker control. This sets the display format and highlights the current day. ```csharp var picker = new DatePicker { DisplayFormat = "yyyy-MM-dd", IsTodayHighlighted = true }; ``` -------------------------------- ### OverlayDialogHost Setup in XAML Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/dialog-controls.md Example of how to include an OverlayDialogHost within a UrsaWindow in XAML for handling overlay dialogs. ```xml ``` -------------------------------- ### ImageViewer Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Demonstrates how to instantiate and configure an ImageViewer control in C#. ```csharp var viewer = new ImageViewer { Source = new Bitmap("image.png"), IsZoomEnabled = true, IsPanEnabled = true, MinZoom = 0.5, MaxZoom = 5.0 }; ``` -------------------------------- ### Right Sidebar Navigation Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/drawer.md Example of showing a non-modal drawer from the right with specified minimum and maximum width. ```csharp OverlayDrawer.ShowStandard( viewModel, hostId: "mainHost", options: new DrawerOptions { Position = Position.Right, CanLightDismiss = true, MinWidth = 300, MaxWidth = 400 } ); ``` -------------------------------- ### TagInput Usage Example - Basic Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/tag-input.md Demonstrates a basic setup of the TagInput control with common properties like placeholder text, maximum count, and duplicate handling. ```APIDOC ## Usage Example ### Basic TagInput ```csharp var tagInput = new TagInput { PlaceholderText = "Enter tags...", MaxCount = 5, AllowDuplicates = false, LostFocusBehavior = LostFocusBehavior.Add, Tags = new ObservableCollection() }; ``` ``` -------------------------------- ### Notification Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/notification-toast.md Demonstrates how to create and display simple and interactive notifications using the Notification class. Includes examples with and without callbacks. ```csharp // Simple information notification var notif = new Notification( title: "Upload Complete", content: "Your file has been uploaded successfully.", type: NotificationType.Success, expiration: TimeSpan.FromSeconds(5) ); // With callbacks var notif2 = new Notification( title: "New Message", content: "You have a new message.", type: NotificationType.Information, expiration: TimeSpan.FromSeconds(7), showClose: true, onClick: () => Console.WriteLine("Notification clicked"), onClose: (reason) => Console.WriteLine($"Closed: {reason}") ); ``` -------------------------------- ### Basic Time Picker Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/date-time-pickers.md Illustrates the basic usage of a TimePicker with placeholder text. ```xml ``` -------------------------------- ### Left Menu Drawer Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/drawer.md Example of showing a non-modal custom drawer from the left, disabling light dismiss and specifying close button visibility. ```csharp OverlayDrawer.ShowCustom( menuViewModel, hostId: "mainHost", options: new DrawerOptions { Position = Position.Left, CanLightDismiss = false, MinWidth = 200, IsCloseButtonVisible = true } ); ``` -------------------------------- ### Setup WindowNotificationManager in MainWindow Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/notification-toast.md Demonstrates how to initialize and configure the `WindowNotificationManager` within a `MainWindow`'s lifecycle. ```csharp public partial class MainWindow : Window { private WindowNotificationManager? _notificationManager; public MainWindow() { InitializeComponent(); this.Opened += (s, e) => { _notificationManager = new WindowNotificationManager(this) { Position = NotificationPosition.TopRight, MaxItems = 5 }; }; } public void ShowNotification(string title, string message) { _notificationManager?.Show(new Notification( title: title, content: message, type: NotificationType.Information, expiration: TimeSpan.FromSeconds(5) )); } } ``` -------------------------------- ### Pagination Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Demonstrates how to configure the Pagination control in XAML for data navigation. ```xml ``` -------------------------------- ### Basic Date Picker Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/date-time-pickers.md Demonstrates a simple DatePicker with a specified display format and placeholder text. ```xml ``` -------------------------------- ### Date-Time Picker Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/date-time-pickers.md Demonstrates a DateTimePicker with a custom display format, confirmation requirement, and placeholder text. ```xml ``` -------------------------------- ### Notification Bell XAML Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/avatar-badge.md A XAML example demonstrating a Badge control used with a Button to create a notification bell icon. ```xml ``` -------------------------------- ### Complete Example: Navigation Drawer Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/drawer.md Demonstrates the creation and usage of a navigation drawer. Includes ViewModel, View, and the code to display the drawer. ```csharp // ViewModel public class NavigationViewModel { public List Items { get; } = new() { new NavItem { Title = "Home", Icon = "home" }, new NavItem { Title = "Settings", Icon = "settings" }, new NavItem { Title = "About", Icon = "info" } }; public Action? OnItemSelected { get; set; } } // View public class NavigationView : UserControl { public NavigationView() { var vm = new NavigationViewModel(); DataContext = vm; Content = new StackPanel { Children = { new TextBlock { Text = "Navigation", FontSize = 18, Margin = new Thickness(16) }, new ItemsControl { Items = vm.Items, ItemTemplate = new FuncDataTemplate((item, _) => new Button { Content = item.Title } ) } } }; } } // Usage OverlayDrawer.ShowStandard( navigationViewModel, hostId: "mainHost", options: new DrawerOptions { Position = Position.Left, CanLightDismiss = true, MinWidth = 250, MaxWidth = 350 } ); ``` -------------------------------- ### Avatar Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/avatar-badge.md Demonstrates how to create and configure an Avatar control in C#. ```csharp var avatar = new Avatar { Source = new Bitmap("avatar.png"), HoverMask = new TextBlock { Text = "Edit Profile" } }; ``` -------------------------------- ### Form Usage Example (C#) Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/form-controls.md Demonstrates how to instantiate and configure a Form control in C#, adding input fields with labels. ```csharp var form = new Form { LabelPosition = Position.Left, LabelWidth = new GridLength(100), LabelAlignment = HorizontalAlignment.Left }; form.Items.Add(new TextBox { [!FormItem.LabelProperty] = new TextBlock { Text = "Name" } }); form.Items.Add(new TextBox { [!FormItem.LabelProperty] = new TextBlock { Text = "Email" } }); ``` -------------------------------- ### LoadingContainer Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Demonstrates how to use the LoadingContainer in XAML to show a loading overlay. ```xml ``` -------------------------------- ### UrsaWindow Customization Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/ursa-window.md Demonstrates how to create and configure a UrsaWindow with custom title bar and resizing options. ```csharp // Create a custom UrsaWindow with title bar customization var window = new UrsaWindow { Title = "My Application", IsTitleBarVisible = true, IsMinimizeButtonVisible = true, IsRestoreButtonVisible = true, IsCloseButtonVisible = true, IsManagedResizerVisible = true, TitleBarContent = new TextBlock { Text = "Custom Title" } }; // Access the main content window.Content = new MainView(); ``` -------------------------------- ### Date Range Picker Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/date-time-pickers.md Shows a DateRangePicker configured with a specific display format and placeholder text. ```xml ``` -------------------------------- ### TagInput Data Binding Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/tag-input.md Provides an example of integrating TagInput with a ViewModel for data binding, showcasing how to manage the Tags collection. ```APIDOC ## Examples ### ViewModel Integration ```csharp public class TagViewModel : NotifyPropertyChangedBase { private ObservableCollection _tags; public ObservableCollection Tags { get => _tags; set => Set(ref _tags, value); } public TagViewModel() { _tags = new ObservableCollection { "csharp", "avalonia" }; } } ``` ### Data Binding ```xml ``` ``` -------------------------------- ### Rating Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Demonstrates how to use the Rating control in XAML, allowing half-star ratings. ```xml ``` -------------------------------- ### QRCode Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Instantiates a QRCode control and sets its content, error correction level, foreground, and background colors. ```csharp var qrCode = new QRCode { Content = "https://example.com", ErrorCorrectionLevel = ErrorCorrectionLevel.M, Foreground = Brushes.Black, Background = Brushes.White }; ``` -------------------------------- ### Add Ursa NuGet Package Source: https://github.com/irihitech/ursa.avalonia/blob/main/README.md Install the core Ursa UI library package using the .NET CLI. ```bash dotnet add package Irihi.Ursa ``` -------------------------------- ### Show Custom and Standard Dialogs Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/dialog-controls.md Demonstrates how to display a non-modal custom dialog and a modal standard dialog with result handling. Requires OverlayDialogHost setup for overlay dialogs. ```csharp // Non-modal custom dialog OverlayDialog.ShowCustom( viewModel, hostId: "mainHost", options: new OverlayDialogOptions { HorizontalAnchor = HorizontalPosition.Center, VerticalAnchor = VerticalPosition.Center, CanDragMove = true } ); // Modal standard dialog with result var result = await OverlayDialog.ShowStandardAsync( confirmViewModel, hostId: "mainHost", options: new OverlayDialogOptions { Title = "Confirm", Mode = DialogMode.Warning, Buttons = DialogButton.YesNo } ); if (result == DialogResult.Ok) { // Process result } ``` -------------------------------- ### MultiComboBox C# Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/combo-list-controls.md Instantiates a MultiComboBox in C# and sets its items and display member path. ```csharp var combo = new MultiComboBox { Items = new[] { "C#", "Python", "JavaScript", "Rust" }, DisplayMemberPath = "." }; ``` -------------------------------- ### Avatar XAML Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/avatar-badge.md Shows how to use the Avatar control in XAML, binding its Source property. ```xml ``` -------------------------------- ### EnumSelector C# Usage Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/combo-list-controls.md Example of how to instantiate and configure an EnumSelector in C#. ```csharp var selector = new EnumSelector { EnumType = typeof(Status), SelectedValue = Status.Active, SelectionMode = EnumSelectionMode.ComboBox }; ``` -------------------------------- ### Timeline Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/other-controls.md Demonstrates how to use the Timeline control in XAML to display events with custom item templates. ```xml ``` -------------------------------- ### Add Semi Design Theme Packages Source: https://github.com/irihitech/ursa.avalonia/blob/main/README.md Install the Semi Design theme package and its Ursa integration for Avalonia applications. ```bash dotnet add package Semi.Avalonia dotnet add package Irihi.Ursa.Themes.Semi ``` -------------------------------- ### Setup OverlayDialogHost in XAML Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/drawer.md Add an OverlayDialogHost to your application's layout to enable drawers and dialogs. Reference it by name or use the default host. ```xml ``` -------------------------------- ### Badge Count Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/avatar-badge.md Configures a Badge control to display a numerical count with an overflow indicator. ```csharp var badge = new Badge { Content = new Button { Content = "Messages" }, Header = "5", // Shows "5" on the badge CornerPosition = CornerPosition.TopRight, OverflowCount = 99 // Shows "99+" if count exceeds 99 }; ``` -------------------------------- ### Form XAML Usage Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/form-controls.md Shows how to define a Form control and its items using XAML, including setting label properties and nesting FormItems. ```xml ``` -------------------------------- ### Badge XAML Count Example Source: https://github.com/irihitech/ursa.avalonia/blob/main/_autodocs/api-reference/avatar-badge.md Demonstrates using a Badge control in XAML to display a count, with content and overflow settings. ```xml