### Install and Configure HandyControl
Source: https://context7.com/handyorg/handycontrol/llms.txt
This snippet demonstrates how to install the library via NuGet and register the necessary resource dictionaries in App.xaml to enable global styling and themes.
```xml
```
--------------------------------
### Install NexT Theme via Git
Source: https://github.com/handyorg/handycontrol/blob/master/doc/themes/next/README.md
Commands to navigate to the Hexo themes directory and clone the NexT repository to install the theme.
```shell
$ cd hexo
$ git clone https://github.com/theme-next/hexo-theme-next themes/next
```
--------------------------------
### Install HandyControl via NuGet
Source: https://github.com/handyorg/handycontrol/blob/master/README.md
The command to install the HandyControl package into your .NET project using the NuGet Package Manager Console.
```powershell
Install-Package HandyControl
```
--------------------------------
### Implement Pagination Control in WPF
Source: https://context7.com/handyorg/handycontrol/llms.txt
Demonstrates how to integrate the Pagination control for large data sets. Includes examples for basic navigation, jump-to-page functionality, and data binding with C# event handling.
```xml
```
```csharp
private void Pagination_PageUpdated(object sender, HandyControl.Data.FunctionEventArgs e)
{
int newPageIndex = e.Info;
LoadDataForPage(newPageIndex);
}
```
--------------------------------
### Drawer Component Examples (XAML)
Source: https://context7.com/handyorg/handycontrol/llms.txt
Illustrates the usage of the Drawer component for creating slide-out panels. This example showcases different docking positions (Left, Right, Bottom), show modes (Push), and mask behaviors (configurable closeability and visibility). It includes toggle buttons to control drawer visibility.
```XAML
```
--------------------------------
### Badge Component Examples
Source: https://context7.com/handyorg/handycontrol/llms.txt
Illustrates the use of the Badge component for displaying notifications, status indicators, and processing animations. Examples cover numeric values, text, dots, processing states, and different color styles.
```xml
```
--------------------------------
### NumericUpDown Control Examples
Source: https://context7.com/handyorg/handycontrol/llms.txt
Demonstrates various configurations of the NumericUpDown control, including setting decimal places, increment steps, minimum/maximum values, and data binding. It allows for flexible numeric input with visual feedback.
```xml
```
--------------------------------
### DatePicker and DateTimePicker Controls
Source: https://context7.com/handyorg/handycontrol/llms.txt
Showcases the DatePicker and DateTimePicker controls for selecting dates and date-times. Examples include setting default dates, applying styles with titles and placeholders, and using data binding for selected values.
```xml
```
--------------------------------
### TabControl with Animations and Close Buttons (XAML)
Source: https://context7.com/handyorg/handycontrol/llms.txt
Demonstrates a TabControl configured with animations, draggable tabs, and close buttons. It includes basic TabItems with simple content panels. This setup is useful for creating user-friendly interfaces where users can manage multiple views.
```XAML
```
--------------------------------
### Define SideMenu Navigation Structure
Source: https://github.com/handyorg/handycontrol/blob/master/doc/source/handycontrol/extend_controls/sideMenu/index.md
This snippet demonstrates how to structure a SideMenu using the hc:SideMenuItem control. It includes examples of using FabricIcons via TextBlock and custom images for menu item icons.
```xml
```
--------------------------------
### Implement Styled and Animated Progress Bars
Source: https://context7.com/handyorg/handycontrol/llms.txt
Shows how to use HandyControl's predefined styles for progress bars, including semantic colors (Success, Info, Warning, Danger) and animated stripe patterns.
```xml
```
--------------------------------
### Configure App.xaml Resources
Source: https://github.com/handyorg/handycontrol/blob/master/README.md
Registers the HandyControl theme and skin resource dictionaries in the application's global resources to apply styles.
```xml
```
--------------------------------
### Apply GPU-Accelerated Image Effects in WPF
Source: https://context7.com/handyorg/handycontrol/llms.txt
Demonstrates how to apply various shader effects like brightness, contrast, grayscale, and color inversion to images. It also shows how to chain multiple effects using the BlendEffectBox container.
```xml
```
--------------------------------
### Implement SearchBar Component
Source: https://context7.com/handyorg/handycontrol/llms.txt
Shows various configurations for the SearchBar, including command binding, real-time search triggers, and styled inputs with validation and placeholders.
```xml
```
--------------------------------
### Display and Manage Dialogs in C#
Source: https://context7.com/handyorg/handycontrol/llms.txt
Use the HandyControl Dialog service to show, initialize, and retrieve results from custom dialogs asynchronously. Supports generic type instantiation and manual lifecycle management for progress indicators.
```csharp
using HandyControl.Controls;
// Simple dialog display
Dialog.Show(new TextDialog());
// Generic show (auto-instantiates the type)
Dialog.Show();
// Async dialog with result
var dialog = Dialog.Show();
string result = await dialog.GetResultAsync();
if (!string.IsNullOrEmpty(result))
{
MessageBox.Show($"Hello, {result}!");
}
// Show progress dialog and close after operation
var progressDialog = Dialog.Show();
await Task.Run(() => {
Thread.Sleep(3000);
});
progressDialog.Close();
// Dialog with initialization
Dialog.Show()
.Initialize(vm => vm.Message = "Custom message")
.GetResultAsync()
.ContinueWith(task => {
var result = task.Result;
});
```
--------------------------------
### HandyControl Loading Indicators
Source: https://context7.com/handyorg/handycontrol/llms.txt
Visual feedback for asynchronous operations using customizable line and circular loading animations. Supports various customization options for dots, speed, and appearance.
```xml
```
--------------------------------
### Define Custom Dialogs with XAML
Source: https://context7.com/handyorg/handycontrol/llms.txt
Create custom modal content by defining user controls with Border containers and HandyControl-specific commands for closing. These controls can be instantiated and displayed dynamically via the Dialog service.
```xml
```
--------------------------------
### Configure Fancybox Plugin
Source: https://github.com/handyorg/handycontrol/blob/master/doc/themes/next/README.md
YAML configuration snippet to enable the Fancybox plugin within the NexT theme configuration file.
```yaml
# Fancybox
# Dependencies: https://github.com/theme-next/theme-next-fancybox
fancybox: false
```
--------------------------------
### Implement SideMenu Navigation
Source: https://context7.com/handyorg/handycontrol/llms.txt
Configures a hierarchical SideMenu with expandable sections, custom icons, and command-based navigation triggers for WPF applications.
```xml
```
--------------------------------
### Configure Plugin CDN Vendors
Source: https://github.com/handyorg/handycontrol/blob/master/doc/themes/next/README.md
YAML configuration snippet for defining custom CDN URLs for theme plugins like Fancybox.
```yaml
vendors:
fancybox:
fancybox_css:
```
--------------------------------
### Implement Growl Notifications
Source: https://context7.com/handyorg/handycontrol/llms.txt
This snippet shows how to define a Growl container in XAML and trigger various notification types (success, info, warning, error, fatal) or confirmation dialogs using C#.
```xml
```
```csharp
using HandyControl.Controls;
Growl.Success("File saved successfully!");
Growl.Info("Your session will expire in 5 minutes.");
Growl.Warning("Disk space is running low.");
Growl.Error("Failed to connect to server.");
Growl.Fatal("Critical system error!");
Growl.Ask("Are you sure you want to delete this item?", isConfirmed =>
{
if (isConfirmed) {
Growl.Success("Item deleted");
}
return true;
});
```
--------------------------------
### Update NexT Theme
Source: https://github.com/handyorg/handycontrol/blob/master/doc/themes/next/README.md
Command to pull the latest changes from the master branch of the NexT theme repository.
```shell
$ cd themes/next
$ git pull
```
--------------------------------
### Implement Modern MessageBox
Source: https://context7.com/handyorg/handycontrol/llms.txt
Replace standard WPF MessageBox with HandyControl's semantic message boxes. Provides built-in icons for success, info, warning, error, and fatal states, as well as confirmation dialogs and owner-window support.
```csharp
using HandyControl.Controls;
// Typed message boxes with icons
MessageBox.Success("Operation completed successfully!", "Success");
MessageBox.Info("Please review the following information.", "Information");
MessageBox.Warning("This action cannot be undone.", "Warning");
MessageBox.Error("An error occurred while processing your request.", "Error");
MessageBox.Fatal("Critical system failure. Please contact support.", "Fatal Error");
// Confirmation dialog
var result = MessageBox.Ask("Do you want to save changes before closing?", "Confirm");
if (result == MessageBoxResult.OK) { }
// Standard WPF-style with custom buttons
var dialogResult = MessageBox.Show(
"Are you sure you want to delete this file?",
"Confirm Delete",
MessageBoxButton.YesNoCancel,
MessageBoxImage.Question,
MessageBoxResult.No
);
// With owner window for proper modal behavior
MessageBox.Show(
Application.Current.MainWindow,
"This dialog is modal to the main window.",
"Modal Dialog",
MessageBoxButton.OK,
MessageBoxImage.Information
);
```
--------------------------------
### Transfer Component API
Source: https://context7.com/handyorg/handycontrol/llms.txt
A dual-panel selection interface for moving items between two lists.
```APIDOC
## [WPF] Transfer Control
### Description
Provides a two-panel interface for selecting items from an available list to a selected list.
### Properties
- **ItemsSource** (Collection) - Required - Data source for the available items
- **SelectionChanged** (Event) - Optional - Event handler for selection updates
### Request Example
```
--------------------------------
### Configure NotifyIcon System Tray
Source: https://context7.com/handyorg/handycontrol/llms.txt
NotifyIcon enables system tray integration with custom context menus and balloon notifications. It requires both XAML configuration for the icon and C# code-behind for event handling.
```xml
```
```csharp
TrayIcon.ShowBalloonTip("Title", "Message content", NotifyIconInfoType.Info);
TrayIcon.IsBlink = true;
private void TrayIcon_DoubleClick(object sender, RoutedEventArgs e)
{
this.Show();
this.WindowState = WindowState.Normal;
this.Activate();
}
```
--------------------------------
### HandyControl TextBox with Title and Validation
Source: https://context7.com/handyorg/handycontrol/llms.txt
Configurable TextBox controls featuring titles, placeholders, and validation indicators using attached properties. Supports various title placements and includes a clear button option.
```xml
```
--------------------------------
### Implement StepBar for Workflow Navigation
Source: https://context7.com/handyorg/handycontrol/llms.txt
The StepBar control provides a visual indicator for multi-step processes. It supports both horizontal layouts with navigation commands and vertical layouts with custom data templates.
```xml
```
--------------------------------
### Configure Transfer Dual-List Selection Component
Source: https://context7.com/handyorg/handycontrol/llms.txt
Implements a two-panel interface for moving items between lists. Includes both the XAML layout definition and the C# ViewModel logic for handling selection changes.
```xml
```
```csharp
public ObservableCollection AvailableItems { get; set; } = new ObservableCollection
{
new ItemModel { Name = "Feature A" },
new ItemModel { Name = "Feature B" },
new ItemModel { Name = "Feature C" },
new ItemModel { Name = "Feature D" },
};
private void Transfer_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var transfer = sender as Transfer;
var selectedItems = transfer.SelectedItems;
}
```
--------------------------------
### SearchBar Component
Source: https://context7.com/handyorg/handycontrol/llms.txt
The SearchBar component is a specialized text input designed for search functionality, supporting command binding and real-time search.
```APIDOC
## SearchBar Component
### Description
Provides a text input optimized for search functionality with command binding support and optional real-time search mode.
### Usage Examples
**Basic Search Bar with Command:**
```xml
```
**Real-time Search:**
```xml
```
**Extended Style with Title:**
```xml
```
**Plus Style with Clear Button and Validation:**
```xml
```
### Properties
- **Command** (ICommand): Command to execute when search is triggered.
- **CommandParameter** (object): Parameter for the command.
- **IsRealTime** (bool): Enables real-time search on each keystroke.
- **SearchStarted** (event): Event triggered when search begins.
- **ShowClearButton** (bool): Displays a button to clear the search text.
- **hc:InfoElement.Title** (string): Title label for the search bar.
- **hc:InfoElement.Placeholder** (string): Placeholder text for the input.
- **hc:InfoElement.Necessary** (bool): Indicates if the field is mandatory.
- **TextType** (TextType): Specifies the type of text input (e.g., Mail).
```
--------------------------------
### ProgressBar Styles API
Source: https://context7.com/handyorg/handycontrol/llms.txt
Enhanced ProgressBar component with semantic coloring and animated stripe patterns.
```APIDOC
## [WPF] ProgressBar Styles
### Description
Standard ProgressBar controls extended with dynamic resource styles for semantic status and visual feedback.
### Styles
- **ProgressBarSuccess** - Green status
- **ProgressBarInfo** - Blue status
- **ProgressBarWarning** - Yellow status
- **ProgressBarDanger** - Red status
- **[Style]Stripe** - Adds animated stripe pattern to the bar
### Request Example
```
--------------------------------
### Pagination Component
Source: https://context7.com/handyorg/handycontrol/llms.txt
The Pagination component allows for easy navigation through large datasets with configurable page counts and jump-to-page functionality.
```APIDOC
## Pagination Component
### Description
Provides page navigation controls for large data sets with configurable page counts and optional jump-to-page functionality.
### Usage Examples
**Basic Pagination:**
```xml
```
**Pagination with Jump Input:**
```xml
```
**Pagination with Custom Page Interval:**
```xml
```
**Data Bound Pagination:**
```xml
```
### C# Event Handling
Handle page changes using the `PageUpdated` event.
```csharp
// C#: Handle page changes
private void Pagination_PageUpdated(object sender, HandyControl.Data.FunctionEventArgs e)
{
int newPageIndex = e.Info;
LoadDataForPage(newPageIndex);
}
```
### Properties
- **MaxPageCount** (int): The maximum number of pages to display.
- **PageIndex** (int): The current active page index.
- **IsJumpEnabled** (bool): Enables or disables the jump-to-page input.
- **MaxPageInterval** (int): The maximum number of page intervals to display.
- **DataCountPerPage** (int): The number of data items per page.
- **PageUpdated** (event): Event triggered when the page is updated.
```
--------------------------------
### HandyControl Button Styles
Source: https://context7.com/handyorg/handycontrol/llms.txt
Semantic button styles with integrated icon support, custom background colors, and corner radius adjustments using attached properties. Includes predefined styles for common actions.
```xml
```
--------------------------------
### Image Effects API
Source: https://context7.com/handyorg/handycontrol/llms.txt
GPU-accelerated shader effects for image manipulation including brightness, contrast, grayscale, and color inversion.
```APIDOC
## [WPF] Image Effects
### Description
Apply GPU-accelerated visual effects to Image controls using HandyControl shader classes.
### Parameters
- **BrightnessEffect** (Property: Brightness) - Optional - Double value (0.0 to 1.0)
- **ContrastEffect** (Property: Contrast) - Optional - Double value
- **GrayScaleEffect** (Property: Scale) - Optional - Double value
### Request Example
```
--------------------------------
### Define HandyControl XML Namespace
Source: https://github.com/handyorg/handycontrol/blob/master/README.md
The XML namespace declaration required to use HandyControl components within your XAML files.
```xml
xmlns:hc="https://handyorg.github.io/handycontrol"
```
--------------------------------
### Implement Rate Component in XAML
Source: https://context7.com/handyorg/handycontrol/llms.txt
The Rate component allows users to provide ratings using star icons. It supports half-star selection, custom icons, read-only modes, and configurable count settings.
```xml
```
--------------------------------
### Implement Card Component in XAML
Source: https://context7.com/handyorg/handycontrol/llms.txt
The Card component provides a container for structured information with optional header and footer sections. It supports custom styling, shadows, and layout arrangements for displaying images and text.
```xml
```
--------------------------------
### DatePicker and DateTimePicker Controls
Source: https://context7.com/handyorg/handycontrol/llms.txt
DatePicker and DateTimePicker facilitate date and date-time selection through calendar interfaces. They offer features like setting default dates, applying extended styles with titles and placeholders, and supporting data binding with custom date formats.
```APIDOC
## DatePicker and DateTimePicker
DatePicker and DateTimePicker controls provide calendar-based date and datetime selection with validation support.
### Basic DatePicker
```xml
```
### DatePicker with Current Date
Initializes the DatePicker with the current system date.
```xml
```
### DatePicker with Title and Placeholder
Applies an extended style with a title, placement options, width, and placeholder.
```xml
```
### Basic DateTimePicker
Allows selection of both date and time, initialized with the current date and time.
```xml
```
### DateTimePicker with Clear Button and Title
Includes a clear button for resetting the selection and an extended style with a title and placeholder.
```xml
```
### DateTimePicker with Data Binding and Custom Format
Binds the selected date and time to a ViewModel property and specifies a custom display format.
```xml
```
```
--------------------------------
### Generate PropertyGrid Editors
Source: https://context7.com/handyorg/handycontrol/llms.txt
The PropertyGrid automatically generates UI editors for object properties. It relies on data models decorated with attributes like Category and DisplayName to organize the generated interface.
```csharp
public class SettingsModel
{
[Category("General")]
[DisplayName("Application Name")]
public string AppName { get; set; }
[Category("General")]
[DisplayName("Max Connections")]
public int MaxConnections { get; set; }
[Category("Appearance")]
[DisplayName("Dark Mode")]
public bool IsDarkMode { get; set; }
[Category("Appearance")]
[DisplayName("Theme Color")]
public Gender Theme { get; set; }
[Category("Layout")]
public HorizontalAlignment HorizontalAlignment { get; set; }
[Category("Layout")]
public VerticalAlignment VerticalAlignment { get; set; }
}
public enum Gender { Male, Female }
```
```xml
```