### Create Project with Blurs Enabled
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Example of creating a new Uranium UI project and enabling the UraniumUI.Blurs setup.
```bash
dotnet new uraniumui-app -n MyProject --Blurs true
```
--------------------------------
### Install Uranium UI Project Templates
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Installs the latest Uranium UI project templates from NuGet. This is the first step for creating new projects with Uranium UI.
```bash
dotnet new install UraniumUI.Templates
```
--------------------------------
### Install CommunityToolkit Dialogs Package
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Install the CommunityToolkit dialogs package using the .NET CLI.
```bash
dotnet add package UraniumUI.Dialogs.CommunityToolkit
```
--------------------------------
### Add UraniumUI.WebComponents Package
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/web-components/CodeView.md
Install the UraniumUI.WebComponents NuGet package using the .NET CLI.
```bash
dotnet add package UraniumUI.WebComponents
```
--------------------------------
### Create Project with Fluent Icons
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Example of creating a new Uranium UI project and specifying the Fluent Icons package.
```bash
dotnet new uraniumui-app -n MyProject --Icons FluentIcons
```
--------------------------------
### Install Mopups Dialogs Package
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Install the Mopups dialogs package using the .NET CLI.
```bash
dotnet add package UraniumUI.Dialogs.Mopups
```
--------------------------------
### Create Project with CommunityToolkit Dialogs
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Example of creating a new Uranium UI project and configuring it to use CommunityToolkit for dialogs.
```bash
dotnet new uraniumui-app -n MyProject --Dialogs CommunityToolkit
```
--------------------------------
### Install DataAnnotations NuGet Package
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/validations/DataAnnotations.md
Install the `UraniumUI.Validations.DataAnnotations` package to enable DataAnnotations validation.
```bash
dotnet add package UraniumUI.Validations.DataAnnotations
```
--------------------------------
### Basic PickerField Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/PickerField.md
Demonstrates the basic setup for a PickerField in XAML, including namespace declarations and binding to an ItemsSource.
```xml
xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
xmlns:m="clr-namespace:UraniumUI.Icons.MaterialSymbols;assembly=UraniumUI.Icons.MaterialSymbols"
```
--------------------------------
### Add UraniumUI.Blurs Package
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Blurs.md
Install the UraniumUI.Blurs NuGet package to your project using the .NET CLI.
```bash
dotnet add package UraniumUI.Blurs
```
--------------------------------
### Basic Chip Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Chip.md
A simple example of how to use the Chip component with just text. Ensure the Material namespace is declared.
```xml
```
--------------------------------
### DataGrid ViewModel Example
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/DataGrid.md
Define a ViewModel with an ObservableCollection of data items to be displayed in the DataGrid. This example uses a simple Student class.
```csharp
public class MainPageViewModel : BindableObject
{
static Random random = new();
public ObservableCollection Items { get; }
public MainPageViewModel()
{
Items = new ObservableCollection();
for (int i = 0; i < 10; i++)
{
Items.Add(new Student
{
Id = i,
Name = "Person " + i,
Age = random.Next(14, 85),
});
}
}
public class Student
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
}
}
```
--------------------------------
### Chip Examples with Customization
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Chip.md
Demonstrates using Chips with different text and controlling the visibility of the remove button. The 'IsDestroyVisible' property defaults to true.
```xml
```
--------------------------------
### Create New Uranium UI Blank Project
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Creates a new, minimal .NET MAUI project with Uranium UI. Use this for a barebones setup. Replace 'MyProject' with your desired project name.
```bash
dotnet new uraniumui-blank-app -n MyProject
```
--------------------------------
### Display Text Prompt
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Illustrates how to use `DisplayTextPromptAsync` to get text input from the user, similar to the default MAUI `DisplayPromptAsync`. Allows setting a placeholder.
```csharp
private async void Button_Clicked(object sender, EventArgs e)
{
var result = await this.DisplayTextPromptAsync("Your Name", "What is your name?", placeholder: "Uvuvwevwevwe...Osas");
await DisplayAlert("Result:", result, "OK");
}
```
--------------------------------
### Configure Segoe Fluent Icon Fonts
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/Icons.md
Add this line to your `MauiProgram.cs` to configure Segoe Fluent icon fonts. This is required after installing the `UraniumUI.Icons.SegoeFluent` package.
```csharp
builder
.UseMauiApp()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFluentIconFonts(); // 👈 Add this line
})
```
--------------------------------
### Basic DynamicContentView Usage in XAML
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/DynamicContentView.md
Demonstrates the basic setup of DynamicContentView in XAML, binding to a boolean value and defining conditions for 'True' and 'False' states.
```xml
xmlns:uranium="http://schemas.enisn-projects.io/dotnet/maui/uraniumui"
```
--------------------------------
### Basic AutoCompleteTextField Setup
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/AutoCompleteTextField.md
This snippet shows how to set up an AutoCompleteTextField with a title, clear button, and binding to suggestion and text properties. Use this for basic text input with dynamic suggestions.
```xml
```
--------------------------------
### All MAUI Material Button Types
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Buttons.md
Demonstrates all available Material button style classes, including their disabled states. This example showcases the visual appearance of each button type.
```xml
```
--------------------------------
### Configure Font Awesome Fonts
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/Icons.md
Add this line to your `MauiProgram.cs` to configure Font Awesome icon fonts. This is required after installing the `UraniumUI.Icons.FontAwesome` package.
```csharp
builder
.UseMauiApp()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFontAwesomeIconFonts(); // 👈 Add this line
})
```
--------------------------------
### Material CheckBox Usage Examples
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/CheckBox.md
Demonstrates various configurations of the Material CheckBox, including default state, pre-checked state, disabled state, and different label positions. Ensure the 'material' namespace is declared.
```xml
```
--------------------------------
### Display RadioButton Prompt using Extension Method
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Show a RadioButton prompt dialog using the extension method to get a single selection from the user.
```csharp
private async void Button_Clicked(object sender, EventArgs e)
{
var result = await this.DisplayRadioButtonPromptAsync(
"Pick some of them below",
new [] {"Option 1", "Option 2", "Option 3"});
}
```
--------------------------------
### Configure Material Symbols Fonts
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/Icons.md
Add this line to your `MauiProgram.cs` to configure Material Symbols icon fonts. This is required after installing the `UraniumUI.Icons.MaterialSymbols` package.
```csharp
builder
.UseMauiApp()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddMaterialSymbolsFonts(); // 👈 Add this line
})
```
--------------------------------
### Define Simple Cascading Style
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/CascadingStyling.md
This example shows how to define a style for `StackLayout` that applies a background color and sets the `TextColor` for all child `Label` elements within that `StackLayout`'s scope.
```xml
```
--------------------------------
### Control Backdrop Presentation with IsPresented
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/Backdrop.md
This example demonstrates how to name a BackdropView using x:Name and control its visibility (show/hide) programmatically via the IsPresented property in C# code-behind.
```xml
```
```csharp
private void OnButtonClicked(object sender, EventArgs e)
{
backdrop.IsPresented = true;
}
```
--------------------------------
### Reference Existing Style in Cascading Resources
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/CascadingStyling.md
This example demonstrates how to reference an existing style (`YellowFrame`) within the `CascadingStyle.Resources` of another style (`MyContainer`). This allows for style inheritance and reuse.
```xml
```
--------------------------------
### Customizing ExpanderView Styles
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/ExpanderView.md
Provides examples for styling the header, content, and arrow of an ExpanderView using custom styles. Apply these styles to modify the appearance of the ExpanderView components.
```xml
```
--------------------------------
### Implement Backdrop with Title and Icon
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/Backdrop.md
This example shows how to add a Backdrop to UraniumContentPage.Attachments, setting both Title and IconImageSource. The Title is used as text for the toolbar item, and IconImageSource is used as an icon. If both are set, Title acts as a hint.
```xml
```
--------------------------------
### Register Default UraniumUI Dialog Service
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Register the default UraniumUI dialog service implementation, which uses MAUI's built-in navigation. No additional NuGet packages are required for this basic setup.
```csharp
builder.Services.AddUraniumUI();
```
--------------------------------
### Customize ButtonView Style
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/ButtonView.md
Define a custom style for ButtonView to modify its appearance, including background color, padding, and corner radius. This example also shows how to apply visual states like PointerOver and Pressed.
```xml
```
--------------------------------
### Customize Button States
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Buttons.md
Define custom styles for different button states (Normal, Disabled, Hover, Focused, Pressed) using `VisualStateManager`. This example sets background colors and shadows for various states.
```xml
```
--------------------------------
### Create New Uranium UI Project
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Creates a new .NET MAUI project pre-configured with Uranium UI. Replace 'MyProject' with your desired project name.
```bash
dotnet new uraniumui-app -n MyProject
```
--------------------------------
### Initialize Material Theme in MauiProgram.cs
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/migration-guides/Migrating-To-2.1.md
Add `.UseUraniumUIMaterial()` to your MauiProgram.cs to initialize the Material Theme. Ensure `AddMaterialIconFonts()` is also included in font configuration.
```csharp
builder
.UseMauiApp()
.UseUraniumUI()
.UseUraniumUIMaterial() // ← This is new!
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddMaterialIconFonts();
});
```
--------------------------------
### Basic ExpanderView Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/ExpanderView.md
Demonstrates how to implement a basic ExpanderView with a header and collapsible content. The content is hidden by default and animates open on user interaction.
```xml
```
--------------------------------
### Apply Validations to a TextField
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Validations.md
Define validations directly within the content of a material:TextField. This example shows how to apply RequiredValidation and LettersOnlyValidation.
```xml
```
--------------------------------
### Customize Button Base Style
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Buttons.md
Customize the base style for all buttons by defining a style in `Resources/Styles.xaml`. This example sets the `BorderWidth` for all buttons.
```xml
```
--------------------------------
### Configure Application Builder
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Blurs.md
Add the UseUraniumUIBlurs() method to your MauiProgram.cs (or Program.cs) to enable blur effects.
```csharp
builder
.UseMauiApp()
.UseUraniumUI()
.UseUraniumUIBlurs() // 👈 Here it is
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
//...
```
--------------------------------
### Enable DataAnnotations Validation for AutoFormView
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/AutoFormView.md
Configure AutoFormView to use DataAnnotations for validation by setting the ValidationFactory in AutoFormViewOptions. Ensure the UraniumUI.Validations.DataAnnotations package is installed.
```csharp
builder.Services.Configure(options =>
{
options.ValidationFactory = DataAnnotationValidation.CreateValidations;
});
```
--------------------------------
### TimePickerField within FormView
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TimePickerField.md
Shows how to integrate TimePickerField with validation rules inside a FormView for form management. Includes a submit button example.
```xml
```
--------------------------------
### Override Material Theme Resources
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Example of how to override Uranium UI Material styles and colors using your own resources. This allows for custom theming.
```xml
```
--------------------------------
### TextField Validation as Child Elements
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TextField.md
Add input validation directly as child elements of the TextField. This approach is suitable for simpler validation setups.
```xml
```
--------------------------------
### Configure Uranium UI Material Theme
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Index.md
Add the UseUraniumUIMaterial() method to your MauiProgram.cs builder chain to enable the Material Theme. The order relative to UseUraniumUI() does not matter, but both must be called.
```csharp
builder
.UseMauiApp()
.UseUraniumUI()
.UseUraniumUIMaterial() // ⁰ This line should be added.
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
```
--------------------------------
### TextField Properties and Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TextField.md
Demonstrates basic usage and configuration of the TextField component, including common properties like Title, Keyboard, and IsPassword.
```APIDOC
## TextField Component Properties
### Text Input Properties
- `Text` (string) - Gets or sets the text value of the TextField.
- `TextColor` (Color) - Gets or sets the color of the text.
- `Keyboard` (Keyboard) - Gets or sets the keyboard type (e.g., Numeric, Email).
- `IsPassword` (bool) - Gets or sets whether the TextField should mask its text.
- `MaxLength` (int) - Gets or sets the maximum length of text allowed.
- `IsTextPredictionEnabled` (bool) - Gets or sets whether text prediction is enabled.
- `CharacterSpacing` (double) - Gets or sets the spacing between characters.
- `HorizontalTextAlignment` (TextAlignment) - Gets or sets the horizontal alignment of the text.
### Behavior Properties
- `AllowClear` (bool) - Gets or sets whether a clear button is shown to clear the text.
- `ClearCommand` (ICommand) - Gets or sets the command to execute when the clear button is pressed.
- `DisallowClearButtonFocus` (bool) - Gets or sets whether the clear button can receive focus.
- `SelectAllTextOnFocus` (bool) - Gets or sets whether all text should be selected when the field receives focus.
- `IsReadOnly` (bool) - Gets or sets whether the TextField is read-only.
- `ReturnType` (ReturnType) - Gets or sets the return key type.
- `ReturnCommand` (ICommand) - Gets or sets the command to execute when the return key is pressed.
- `ReturnCommandParameter` (object) - Gets or sets the parameter for the return command.
### Selection Properties
- `SelectionLength` (int) - Gets or sets the length of the selected text.
- `CursorPosition` (int) - Gets or sets the position of the cursor.
- `SelectionHighlightColor` (Color) - Gets or sets the color of the text selection highlight.
### Icon Property
- `Icon` (ImageSource) - Sets an icon on the left side of the control. FontImageSource is recommended.
### AccentColor Property
- `AccentColor` (Color) - The color used to fill the border and icon when the control is focused.
### Attachments Property
- `Attachments` (ICollection) - A collection of additional controls to be placed inside the control, on the end.
## TextField Events
- `TextChanged` - Occurs when the text value changes.
- `Completed` - Occurs when the user completes the text input.
## TextField Methods
- `ClearValue()` - Clears the text value of the TextField.
- `SelectAllText()` - Selects all text in the TextField.
- `DisplayValidation()` - Displays validation results.
- `ResetValidation()` - Resets the validation state and clears the text.
```
--------------------------------
### Customizing DataGrid Cell Item Template
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/DataGrid.md
Customize the appearance of individual cells using the CellItemTemplate property. This example uses an Editor for two-way binding.
```xml
```
--------------------------------
### Custom Email Validation Implementation
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Validations.md
Implement the IValidation interface to create a custom validation rule. This example, MyEmailValidation, checks for a valid email format.
```csharp
public class MyEmailValidation : IValidation
{
public string Message { get; set; } = "Please enter a valid email address.";
public bool Validate(object value)
{
if (value is string text)
{
return text.Count(x => x == '@') == 1 && text.Split('@').Last().Length >= 2;
}
return false;
}
}
```
--------------------------------
### Display Radio Button Prompt with Object Collection
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Demonstrates how to use the `DisplayRadioButtonPromptAsync` method with a collection of custom objects. Specifies a `displayMember` to show object properties. Requires a custom `MyOption` class.
```csharp
private async void Button_Clicked(object sender, EventArgs e)
{
var options = new List()
{
new MyOption() { Name = "Option 1", Description = "Description 1" },
new MyOption() { Name = "Option 2", Description = "Description 2" },
new MyOption() { Name = "Option 3", Description = "Description 3" },
};
var result = await this.DisplayRadioButtonPromptAsync(
"Pick some of them below",
options,
options[1],
"OK",
"Cancel",
"Name");
await this.DisplayAlert("Result", result.Name, "OK");
}
```
--------------------------------
### FormView with Multiple Validations
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/Validations.md
Use FormView to manage and validate multiple inputs simultaneously. This example includes RequiredValidation for a CheckBox and RegexValidation for an Email TextField.
```xml
```
--------------------------------
### Basic TextField Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TextField.md
Demonstrates how to declare and use basic TextFields in XAML. Ensure the necessary namespaces are included.
```xml
xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
xmlns:m="clr-namespace:UraniumUI.Icons.MaterialSymbols;assembly=UraniumUI.Icons.MaterialSymbols"
```
--------------------------------
### Include Raw Assets with MauiAsset
Source: https://github.com/enisn/uraniumui/blob/develop/demo/UraniumApp/Resources/Raw/AboutAssets.txt
Configure your .csproj file to include raw assets from the Resources\Raw directory and its subdirectories. These assets will be deployed with your application package.
```xml
```
--------------------------------
### FormView Integration with Multiple TextFields
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TextField.md
Integrate TextFields within a FormView for comprehensive form management. This example includes various validation types and input configurations.
```xml
```
--------------------------------
### Load Maui Asset at Runtime
Source: https://github.com/enisn/uraniumui/blob/develop/demo/UraniumApp/Resources/Raw/AboutAssets.txt
Access deployed raw assets from your application package using the FileSystem.OpenAppPackageFileAsync method. Ensure the asset name matches the LogicalName specified in the .csproj file.
```csharp
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}
```
--------------------------------
### TextField Validation with Validations Property
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TextField.md
Configure input validation for a TextField using the Validations property. This example shows required and regex validations for an email field.
```xml
```
--------------------------------
### Display CheckBox Prompt using Extension Method
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Show a CheckBox prompt dialog using the extension method for simple dialog display.
```csharp
public partial class MainPage : ContentPage
{
private async void ShowDialog_Clicked(object sender, EventArgs e)
{
var result = await this.DisplayCheckBoxPromptAsync(
"Select Options",
new[] { "Option 1", "Option 2", "Option 3" });
}
}
```
--------------------------------
### Configure Mopups in MauiProgram.cs
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Configure Mopups by adding the `ConfigureMopups()` extension method in your MauiProgram.cs file.
```csharp
builder
.UseMauiApp()
.UseUraniumUI()
.UseUraniumUIMaterial()
.ConfigureMopups() // 👈 Add this line
// ...
```
--------------------------------
### Basic StatefulContentView Usage in XAML
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/StatefulContentView.md
Demonstrates how to use StatefulContentView in XAML to create a clickable view with a Border and Label. The LongPressCommand is bound to a ViewModel command.
```xml
```
--------------------------------
### Basic DatePickerField Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/DatePickerField.md
Demonstrates how to include and use the DatePickerField in XAML. Ensure the correct namespaces are imported.
```xml
xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
xmlns:m="clr-namespace:UraniumUI.Icons.MaterialSymbols;assembly=UraniumUI.Icons.MaterialSymbols"
```
--------------------------------
### Apply Simple Cascading Style
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/CascadingStyling.md
Demonstrates how to apply a `StackLayout` with the `MyContainer` style class. Labels within this container will inherit the cascading styles.
```xml
```
--------------------------------
### Customize AutoFormView FooterLayout with FlexLayout
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/AutoFormView.md
Use the FooterLayout property to define a custom layout for elements appearing below the form fields, such as buttons. This example uses a FlexLayout for horizontal alignment.
```xml
```
--------------------------------
### Basic CodeView Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/web-components/CodeView.md
Render a C# code snippet with syntax highlighting using the CodeView component. Specify the language and source code.
```xml
```
--------------------------------
### Add CommunityToolkit Dialog Services
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Register the required services for CommunityToolkit dialogs in your MauiProgram.cs file.
```csharp
builder.Services.AddCommunityToolkitDialogs();
```
--------------------------------
### Configure AutoFormViewOptions in MauiProgram.cs
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/AutoFormView.md
Configure global AutoFormView options, such as validation factories or editor mappings, within the MauiProgram.cs file using dependency injection.
```csharp
builder.Services.Configure(options =>
{
// configure options here
});
```
--------------------------------
### Create a Floating Action Button Attachment in C#
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/UraniumContentPage.md
Define a custom attachment class that inherits from ImageButton and IPageAttachment. This example creates a simple FAB with basic styling and click handling.
```csharp
public class FAB : ImageButton, IPageAttachment
{
public FAB()
{
this.Source = new Uri("arrow.png");
this.Width = 42;
this.Height = 42;
this.CornerRadius = 21;
this.BackgroundColor = Colors.Blue;
this.Click += (s, e) => { Console.WriteLine("FAB clicked"); };
}
public AttachmentPosition AttachmentPosition => AttachmentPosition.Front;
public void OnAttached(UraniumContentPage page)
{
// Place it right bottom of the page.
this.TranslationX = this.PageWidth - this.Width - 20;
this.TranslationY = this.PageHeight - this.Height - 20;
}
}
```
--------------------------------
### Use Font Awesome Icon in XAML
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/Icons.md
Example of using a Font Awesome icon with `FontImageSource` in XAML. Ensure the correct `FontFamily` and `Glyph` are used. The `fa` XML namespace must be declared.
```xml
```
--------------------------------
### Create New UraniumContentPage with CLI
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/infrastructure/UraniumContentPage.md
Use the dotnet CLI to create a new Uranium ContentPage, specifying the page name and namespace.
```bash
dotnet new uraniumcontentpage -n MyPage -na MyNamespace
```
--------------------------------
### Override Existing Styles with StyleResource
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/ColorsAndStyles.md
Define specific styles within the `Overrides` property of `StyleResource` to replace default Uranium UI Material Theme styles. This example overrides the Button style.
```xml
```
--------------------------------
### Register Uranium UI and Web Components
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/web-components/CodeView.md
Register the necessary Uranium UI services and web components in your MauiProgram.cs file.
```csharp
builder
.UseMauiApp()
.UseUraniumUI()
.UseUraniumUIWebComponents();
```
--------------------------------
### TabView with ContentTemplate
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TabView.md
Demonstrates how to use the TabView component with ContentTemplate for lazy loading tab content. This is performance-friendly for many tabs.
```xml
xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
xmlns:m="clr-namespace:UraniumUI.Icons.MaterialSymbols;assembly=UraniumUI.Icons.MaterialSymbols"
```
--------------------------------
### Customizing TreeView Nodes with ItemTemplate
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/TreeView.md
Customize the appearance of individual tree nodes using the ItemTemplate property, similar to ListView or CollectionView. This example displays a folder icon, the item name, and the count of its children.
```xml
```
--------------------------------
### Basic MultiplePickerField Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/MultiplePickerField.md
Demonstrates how to declare and configure a basic MultiplePickerField with a title and a list of string options.
```xml
Option 1Option 2Option 3Option 4Option 5Option 6
```
--------------------------------
### Basic EditorField Usage
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/EditorField.md
Demonstrates the basic usage of the EditorField component with a title.
```xml
```
--------------------------------
### ViewModel for Paginator
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/Paginator.md
Implement a ViewModel with properties for CurrentPage, TotalPages, and a command to handle page changes. Ensure INotifyPropertyChanged is implemented for property updates.
```csharp
public class MyViewModel : BindableObject
{
private int currentPage = 1;
private int totalPages = 10;
public int CurrentPage
{
get => currentPage;
set
{
if (currentPage != value)
{
currentPage = value;
OnPropertyChanged();
}
}
}
public int TotalPages
{
get => totalPages;
set
{
if (totalPages != value)
{
totalPages = value;
OnPropertyChanged();
}
}
}
public ICommand SetPageCommand => new Command(page =>
{
CurrentPage = page;
// Load data for the new page
});
}
```
--------------------------------
### DataGrid Custom Column with Button Action
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/themes/material/components/DataGrid.md
Create a custom column without a direct property mapping using CellItemTemplate to include interactive elements like buttons. This example shows a 'Remove' button linked to a command.
```xml
```
--------------------------------
### Use Material Symbols Icon in XAML
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/Icons.md
Example of using a Material Symbols icon with `FontImageSource` in XAML. You can specify different styles like 'MaterialSharp' or 'MaterialSharpFilled' via the `FontFamily` property. The `m` XML namespace must be declared.
```xml
```
--------------------------------
### Configure Uranium UI Handlers in MauiProgram.cs
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/Getting-Started.md
Adds the necessary Uranium UI handlers to your .NET MAUI application's MauiProgram.cs file. Ensure both `.UseUraniumUI()` and `.UseUraniumUIMaterial()` are called.
```csharp
.UseUraniumUI()
.UseUraniumUIMaterial() // "
```
--------------------------------
### Define Nested Cascading Styles
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/theming/CascadingStyling.md
This example illustrates nested cascading styles. A `StackLayout` with `MyContainer` applies a yellow background to child `Frame` elements, and these `Frame` elements, in turn, apply a black text color to their child `Label` elements.
```xml
```
--------------------------------
### Displaying a Date Prompt
Source: https://github.com/enisn/uraniumui/blob/develop/docs/en/dialogs/Index.md
Shows how to display a nullable date prompt to the user. The dialog supports OK, Cancel, Clear, and Today actions. The result is assigned back to the selected date variable.
```csharp
private DateTime? selectedDate = DateTime.Today;
private async void Button_Clicked(object sender, EventArgs e)
{
selectedDate = await this.DisplayDatePromptAsync(
"Select Date",
selectedDate,
minimumDate: DateTime.Today.AddDays(-30),
maximumDate: DateTime.Today.AddDays(30));
await DisplayAlert("Result:", selectedDate?.ToString("d") ?? "null", "OK");
}
```