KotBehamot.RadialSegmentControl
1.0.0
dotnet add package KotBehamot.RadialSegmentControl --version 1.0.0
NuGet\Install-Package KotBehamot.RadialSegmentControl -Version 1.0.0
<PackageReference Include="KotBehamot.RadialSegmentControl" Version="1.0.0" />
<PackageVersion Include="KotBehamot.RadialSegmentControl" Version="1.0.0" />
<PackageReference Include="KotBehamot.RadialSegmentControl" />
paket add KotBehamot.RadialSegmentControl --version 1.0.0
#r "nuget: KotBehamot.RadialSegmentControl, 1.0.0"
#:package KotBehamot.RadialSegmentControl@1.0.0
#addin nuget:?package=KotBehamot.RadialSegmentControl&version=1.0.0
#tool nuget:?package=KotBehamot.RadialSegmentControl&version=1.0.0
RadialSegmentControl
<div align="center">
</div>
<div align="center"> <img src="assets/icon.png" alt="RadialSegmentControl Icon" width="128" height="128" /> </div>
A high-quality, customizable radial/circular segment button control library for .NET MAUI applications. This library provides an interactive circular button interface with customizable segments, following SOLID principles and best practices for library development.
โจ Features
- ๐ฏ Radial Segment Layout: Display buttons in a circular/radial pattern
- ๐จ Customizable Appearance: Configure colors, text, and styling for each segment
- ๐ฑ Touch Interaction: Full support for tap/click interactions
- ๐ Extensible Design: Implement custom drawables through the
IRadialSegmentDrawableinterface - ๐ฆ MVVM Support: Bindable properties and command support
- ๐ญ Event-Driven: Events and commands for segment selection
๐ฆ Installation
Install via NuGet Package Manager:
dotnet add package KotBehamot.RadialSegmentControl
Or via Package Manager Console:
Install-Package KotBehamot.RadialSegmentControl
๐ Quick Start
Basic Usage
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:RadialSegmentControl.Controls;assembly=RadialSegmentControl"
x:Class="YourApp.MainPage">
<controls:RadialSegmentControl x:Name="radialControl"
WidthRequest="300"
HeightRequest="300"
CenterRadius="30"
SegmentSelected="OnSegmentSelected" />
</ContentPage>
Code-Behind
using RadialSegmentControl.Models;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
// Add segments programmatically
radialControl.Segments.Add(new RadialSegment
{
Text = "Option 1",
BackgroundColor = Colors.Blue,
TextColor = Colors.White,
Value = "value1"
});
radialControl.Segments.Add(new RadialSegment
{
Text = "Option 2",
BackgroundColor = Colors.Green,
TextColor = Colors.White,
Value = "value2"
});
radialControl.Segments.Add(new RadialSegment
{
Text = "Option 3",
BackgroundColor = Colors.Red,
TextColor = Colors.White,
Value = "value3"
});
}
private void OnSegmentSelected(object sender, SegmentSelectedEventArgs e)
{
DisplayAlert("Selected", $"You selected: {e.Segment.Text}", "OK");
}
}
MVVM Usage
using System.Collections.ObjectModel;
using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using RadialSegmentControl.Models;
public partial class MainViewModel : ObservableObject
{
[ObservableProperty]
private ObservableCollection<RadialSegment> segments;
[ObservableProperty]
private RadialSegment? selectedSegment;
public ICommand SegmentSelectedCommand { get; }
public MainViewModel()
{
Segments = new ObservableCollection<RadialSegment>
{
new RadialSegment { Text = "A", BackgroundColor = Colors.Blue, TextColor = Colors.White },
new RadialSegment { Text = "B", BackgroundColor = Colors.Green, TextColor = Colors.White },
new RadialSegment { Text = "C", BackgroundColor = Colors.Red, TextColor = Colors.White }
};
SegmentSelectedCommand = new RelayCommand<RadialSegment>(OnSegmentSelected);
}
private void OnSegmentSelected(RadialSegment? segment)
{
if (segment != null)
{
// Handle selection
}
}
}
<controls:RadialSegmentControl Segments="{Binding Segments}"
SelectedSegment="{Binding SelectedSegment}"
SegmentSelectedCommand="{Binding SegmentSelectedCommand}"
WidthRequest="300"
HeightRequest="300" />
๐ง Advanced Usage
Custom Drawable
Create a custom rendering implementation by implementing IRadialSegmentDrawable:
using RadialSegmentControl.Interfaces;
using RadialSegmentControl.Models;
public class CustomRadialDrawable : IRadialSegmentDrawable
{
public void DrawSegment(ICanvas canvas, RadialSegment segment,
float centerX, float centerY, float radius, bool isSelected)
{
// Custom drawing logic
}
public void DrawCenter(ICanvas canvas, float centerX, float centerY, float radius)
{
// Custom center circle drawing
}
}
// Use custom drawable
var control = new RadialSegmentControl(new CustomRadialDrawable());
๐ API Reference
RadialSegmentControl
Properties:
Segments(ObservableCollection<RadialSegment>): Collection of segments to displaySelectedSegment(RadialSegment?): Currently selected segment (bindable, two-way)CenterRadius(float): Radius of the center circle (default: 30)SegmentSelectedCommand(ICommand?): Command executed when a segment is selected
Events:
SegmentSelected: Raised when a segment is selected
RadialSegment
Properties:
Id(string): Unique identifierText(string): Display textBackgroundColor(Color): Segment background colorTextColor(Color): Text colorValue(object?): Associated value/dataIsEnabled(bool): Whether segment is enabledStartAngle(float): Start angle in degrees (auto-calculated)SweepAngle(float): Segment size in degrees (auto-calculated)Metadata(IDictionary<string, object>): Additional custom data
๐๏ธ Architecture & SOLID Principles
This library is built with clean architecture and SOLID principles:
Single Responsibility Principle (SRP)
RadialSegment: Pure data model - only stores segment informationRadialSegmentControl: Manages control lifecycle, events, and bindingsIRadialSegmentDrawable: Defines rendering contractBasicRadialSegmentDrawable: Implements default rendering logicRadialSegmentBuilder: Handles fluent object constructionRadialSegmentExtensions: Provides utility operations
Open/Closed Principle (OCP)
- Extensible: Create custom rendering by implementing
IRadialSegmentDrawable - Closed for modification: Core control logic doesn't change when adding new visual styles
- Example: Swap rendering implementations without touching control code
Liskov Substitution Principle (LSP)
- Properly inherits from
GraphicsView - All
IRadialSegmentDrawableimplementations are interchangeable - Maintains expected behavior across substitutions
Interface Segregation Principle (ISP)
IRadialSegmentDrawable: Contains only drawing methods- No forced implementation of unused functionality
- Clean, focused contracts
Dependency Inversion Principle (DIP)
RadialSegmentControldepends onIRadialSegmentDrawableabstraction- Concrete implementations injected via constructor
- Easily testable through mocking
๐จ Use Cases
Radial Menus
Perfect for creating circular context menus and radial selection interfaces.
Music Applications
Ideal for key signature selection, chord progression wheels, or music theory tools.
Navigation Controls
Create unique circular navigation interfaces for mobile apps.
Data Visualization
Interactive pie charts with selectable segments.
Game Interfaces
Circular skill trees, radial weapon selectors, or ability wheels.
๐ Platform Support
| Platform | Supported | Notes |
|---|---|---|
| ๐ค Android | โ Yes | Tested on Android 7.0+ |
| ๐ iOS | โ Yes | Tested on iOS 14.0+ |
| ๐ช Windows | โ Yes | Windows 10 1809+ |
| ๐ macOS | โ Yes | macOS 10.15+ |
| ๐ Mac Catalyst | โ Yes | macOS 10.15+ |
โก Performance
- Optimized rendering using
ICanvasfor hardware acceleration - Efficient hit-testing with mathematical calculations (no pixel iteration)
- Minimal allocations - reuses objects where possible
- Smooth animations - 60 FPS on modern devices
๐ Requirements
- .NET: 8.0 or later
- MAUI: 8.0 or later
- C#: 12.0 or later
๐ Known Limitations
- Segment count: Recommended 2-12 segments for optimal usability
- Text length: Best with short labels (1-10 characters)
- Center radius: Should be proportional to control size (10-30% of radius)
๐ Documentation
- Changelog: Detailed version history
- Contributing Guidelines: How to contribute
- API Documentation: Full API reference
- Sample Project: Working examples
๐ท๏ธ Versioning
This project adheres to Semantic Versioning:
- MAJOR: Incompatible API changes
- MINOR: Backwards-compatible functionality additions
- PATCH: Backwards-compatible bug fixes
Current version: 1.0.0
๐ก๏ธ Security
For security concerns, please see our Security Policy.
๐ฌ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: Create an issue for support
๐ Star History
If you find this library useful, please consider giving it a โญ on GitHub!
๐ค Contributing
Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.
Ways to Contribute
- ๐ Report bugs
- ๐ก Suggest features
- ๐ Improve documentation
- ๐ง Submit pull requests
- โญ Star the repository
- ๐ข Spread the word
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2025 KotBehamot
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
๐ Acknowledgments
- Extracted from the MusicKeyChanger project
- Built with .NET MAUI
- Inspired by radial menu patterns in modern UIs
๐จโ๐ป Authors
- KotBehamot - GitHub Profile
๐ Project Structure
RadialSegmentControl/
โโโ src/
โ โโโ RadialSegmentControl/ # Main library
โ โโโ Controls/ # UI Controls
โ โโโ Models/ # Data models
โ โโโ Interfaces/ # Abstractions
โ โโโ Drawing/ # Rendering implementations
โ โโโ Builders/ # Builder patterns
โ โโโ Adapters/ # Adapter patterns
โ โโโ Extensions/ # Extension methods
โ โโโ Events/ # Event arguments
โโโ tests/
โ โโโ RadialSegmentControl.Tests/ # Unit tests
โโโ samples/
โ โโโ RadialSegmentControl.Sample/ # Sample application
โโโ docs/# Documentation
โโโ assets/# Package assets (icon, etc.)
<div align="center">
Made with โค๏ธ by KotBehamot
Report Bug ยท Request Feature ยท Documentation
</div>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.0)
- Microsoft.Maui.Graphics (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.0.0 | 266 | 10/28/2025 |