### Install LucideAvalonia via CLI
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Commands to add the LucideAvalonia NuGet package to your project using the .NET CLI or NuGet Package Manager Console.
```bash
dotnet add package LucideAvalonia
```
```powershell
Install-Package LucideAvalonia
```
--------------------------------
### Install LucideAvalonia NuGet Package
Source: https://github.com/marwanfr/lucideavaloniaui/blob/main/README.md
Command to add the LucideAvalonia package to your AvaloniaUI project using the .NET CLI. Ensure you are using AvaloniaUI version 11.1.0-beta1 or higher.
```sh
dotnet add package LucideAvalonia
```
--------------------------------
### Avalonia UI Application Structure with Lucide Icons
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
This example demonstrates a complete Avalonia UI application structure incorporating Lucide icons. It shows how to set up the application's main window, including a toolbar and sidebar, using the Lucide Avalonia component for icons. The XAML defines the layout and integrates icons with specific properties like color and size.
```xml
```
```xml
```
--------------------------------
### Using LucideIconNames Enum in Avalonia
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Illustrates the usage of the `LucideIconNames` enum for accessing over 1690 icons in a strongly-typed manner. It shows common icon categories and provides an example of iterating through all available icons programmatically.
```csharp
using LucideAvalonia.Enum;
// Common icon categories and examples:
// Navigation
LucideIconNames.ArrowUp
LucideIconNames.ArrowDown
LucideIconNames.ArrowLeft
LucideIconNames.ArrowRight
LucideIconNames.ChevronUp
LucideIconNames.ChevronDown
LucideIconNames.Home
LucideIconNames.Menu
// Actions
LucideIconNames.Search
LucideIconNames.Settings
LucideIconNames.Trash2
LucideIconNames.Edit
LucideIconNames.Copy
LucideIconNames.Download
LucideIconNames.Upload
LucideIconNames.Save
// Media
LucideIconNames.Play
LucideIconNames.Pause
LucideIconNames.Music
LucideIconNames.Camera
LucideIconNames.Video
// Communication
LucideIconNames.Mail
LucideIconNames.MessageCircle
LucideIconNames.Phone
LucideIconNames.Send
// Status
LucideIconNames.Check
LucideIconNames.X
LucideIconNames.AlertCircle
LucideIconNames.Info
LucideIconNames.Bell
// Social
LucideIconNames.Heart
LucideIconNames.Star
LucideIconNames.ThumbsUp
LucideIconNames.Share
// Weather
LucideIconNames.Sun
LucideIconNames.Moon
LucideIconNames.Cloud
LucideIconNames.CloudRain
// Iterate all icons programmatically
foreach (LucideIconNames iconName in Enum.GetValues())
{
Console.WriteLine(iconName.ToString());
}
```
--------------------------------
### Integrate and Customize Lucide Icon in AXAML
Source: https://github.com/marwanfr/lucideavaloniaui/blob/main/README.md
Example of how to embed a Lucide icon (e.g., 'Heart') within your AvaloniaUI application's AXAML markup. Demonstrates basic customization of color, stroke thickness, and dimensions.
```axaml
```
--------------------------------
### Customizing Lucide Control Properties in Avalonia
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Explains the four main styled properties of the `Lucide` control in Avalonia: `Icon`, `StrokeBrush`, `StrokeThickness`, and `IconSource`. It provides examples of how to set these properties to customize the appearance of icons, including standard Avalonia layout properties.
```csharp
using Avalonia;
using Avalonia.Media;
using LucideAvalonia;
using LucideAvalonia.Enum;
// Property: Icon (LucideIconNames)
// Sets which icon to display from the enum
var icon = new Lucide();
icon.Icon = LucideIconNames.Heart;
// Property: StrokeBrush (IBrush?)
// Sets the color of the icon stroke
icon.StrokeBrush = new SolidColorBrush(Colors.Red);
icon.StrokeBrush = new SolidColorBrush(Color.Parse("#89b4fa"));
// Property: StrokeThickness (double)
// Sets the thickness of the icon stroke lines
icon.StrokeThickness = 1.5; // Thin stroke
icon.StrokeThickness = 2.0; // Default/medium stroke
icon.StrokeThickness = 3.0; // Bold stroke
// Property: IconSource (object?)
// Read-only property containing the DrawingImage source
// Automatically updated when Icon property changes
var source = icon.IconSource; // Returns DrawingImage
// Standard Avalonia properties also apply
icon.Width = 48;
icon.Height = 48;
icon.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center;
icon.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center;
icon.Margin = new Thickness(8);
```
--------------------------------
### Programmatically Create Lucide Icons in C#
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Shows how to instantiate the Lucide control in code-behind. This is useful for dynamic UI generation or scenarios where icons are determined at runtime.
```csharp
var heartIcon = new Lucide
{
Icon = LucideIconNames.Heart,
StrokeBrush = new SolidColorBrush(Color.Parse("#f38ba8")),
StrokeThickness = 1.5,
Width = 32,
Height = 32
};
```
--------------------------------
### Display Lucide Icons in XAML
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Demonstrates how to declare the Lucide namespace and use the Lucide control within an AvaloniaUI AXAML file. Properties like Icon, StrokeBrush, and StrokeThickness are used to customize the appearance.
```xml
```
--------------------------------
### Generate Icons from Local SVGs using Python
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
This Python script generates Avalonia UI icon definitions from a local directory of SVG files. It requires the path to the SVG directory and can optionally specify the output directory and version. The output includes C# enum entries and XAML resource files.
```python
python tools/generate_icons.py --icons-dir ./path/to/svgs
python tools/generate_icons.py --version 1.7.0 --output-dir ./MyProject/Icons
```
--------------------------------
### Generating Lucide Icons with Python Script
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Details the use of a Python script included in the library to regenerate Lucide icons. This process is essential for updating the icon set from newer Lucide releases, automatically updating the enum definitions and XAML resources.
```bash
# Download and generate from a specific Lucide version
python tools/generate_icons.py --version 1.7.0
```
--------------------------------
### Update Lucide Icons using Python Script
Source: https://github.com/marwanfr/lucideavaloniaui/blob/main/README.md
Command to run the provided Python script for regenerating icons from a newer Lucide release. This script updates the icon enum and resource files. Requires Python 3.10+.
```python
python tools/generate_icons.py --version
```
--------------------------------
### Data Binding Lucide Icon Properties in Avalonia
Source: https://context7.com/marwanfr/lucideavaloniaui/llms.txt
Demonstrates how to use data binding to dynamically update the `Icon` and `StrokeThickness` properties of a Lucide control based on UI element interactions like ComboBox selection and Slider value changes. This enables reactive UI updates.
```csharp
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Media;
using LucideAvalonia;
using LucideAvalonia.Enum;
public partial class IconPickerWindow : Window
{
public IconPickerWindow()
{
InitializeComponent();
BuildInteractiveDemo();
}
private void BuildInteractiveDemo()
{
// ComboBox with all available icons
var allIcons = System.Enum.GetValues();
var comboBox = new ComboBox
{
ItemsSource = allIcons,
SelectedIndex = Array.IndexOf(allIcons, LucideIconNames.Rocket),
Width = 200
};
// Slider for stroke thickness
var thicknessSlider = new Slider
{
Minimum = 0.5,
Maximum = 3.0,
Value = 2.0,
Width = 150
};
// Icon with data bindings
var dynamicIcon = new Lucide
{
Width = 64,
Height = 64,
StrokeBrush = new SolidColorBrush(Colors.White),
// Bind Icon property to ComboBox selection
[!Lucide.IconProperty] = new Binding("SelectedItem") { Source = comboBox },
// Bind StrokeThickness to slider value
[!Lucide.StrokeThicknessProperty] = new Binding("Value") { Source = thicknessSlider }
};
// Display selected icon name
var iconNameLabel = new TextBlock
{
[!TextBlock.TextProperty] = new Binding("SelectedItem") { Source = comboBox }
};
var panel = new StackPanel { Spacing = 16, Margin = new Thickness(24) };
panel.Children.Add(comboBox);
panel.Children.Add(thicknessSlider);
panel.Children.Add(dynamicIcon);
panel.Children.Add(iconNameLabel);
this.Content = panel;
}
}
```
--------------------------------
### Declare LucideAvalonia Namespace in AXAML
Source: https://github.com/marwanfr/lucideavaloniaui/blob/main/README.md
Adds the necessary namespace declaration to your AXAML file's header, enabling the use of LucideAvalonia components.
```axaml
xmlns:lucideAvalonia="clr-namespace:LucideAvalonia;assembly=LucideAvalonia"
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.