Siticone Bluetooth Button
The SiticoneBluetoothButton is a sophisticated control designed to manage and visualize Bluetooth connectivity.
It goes beyond a simple icon, offering state-aware animations (connecting pulses, signal strength indicators),
real-time hardware monitoring via Windows APIs, and extensive theming capabilities suitable for modern dashboards and IoT applications.
Core State & Behavior
Properties controlling the primary logic and connection status.
| Property | Type | Description & Usage Example |
|---|---|---|
State |
BluetoothState | btBtn.State = BluetoothState.Connecting; Controls the visual mode. States include Idle, Connecting (animated), Connected, Paired, High/Medium/Low signal, Error, and more. |
SignalStrength |
int |
btBtn.SignalStrength = 85;
Sets the signal percentage (0-100). Automatically updates the State to Low/Medium/High if manually setting signal data.
|
IsSecured |
bool | btBtn.IsSecured = true; If true, overlays a lock icon on the button to indicate an encrypted or authenticated connection. |
EnableUltraPerformanceMode |
bool | btBtn.EnableUltraPerformanceMode = true; When enabled, disables all CPU-intensive animations (ripples, pulses, fades) for use in high-density lists or grids. |
Real-Time Monitoring
The control can automatically interface with the Windows Bluetooth Stack (via bthprops.cpl) to reflect the actual system status.
| Property | Type | Description & Usage Example |
|---|---|---|
EnableRealTimeDetection |
bool | btBtn.EnableRealTimeDetection = true; Activates a background task that polls the OS for Bluetooth radio status, visibility, and signal strength. |
RealTimeMonitoringInterval |
int | btBtn.RealTimeMonitoringInterval = 3000; Polling frequency in milliseconds. Default is 3000ms (3 seconds). |
CurrentDeviceName |
string | var dev = btBtn.CurrentDeviceName; Read-only. Returns the name of the currently detected Bluetooth radio or connected device when monitoring is active. |
Appearance & Themes
Customize the visual style using presets or granular color properties.
| Property | Type | Description & Usage Example |
|---|---|---|
Theme |
BluetoothButtonTheme | btBtn.Theme = BluetoothButtonTheme.Modern; Applies a preset color scheme (Modern, Light, Dark, Colorful, Minimal). |
ActiveColor |
Color | btBtn.ActiveColor = Color.DodgerBlue; Color used for the main Bluetooth symbol when active or connected. |
IdleColor |
Color | btBtn.IdleColor = Color.Gray; Color used when the state is Idle. |
ConnectingSignalColor |
Color | btBtn.ConnectingSignalColor = Color.Blue; Color for the animated dots/pulses during connection attempts. |
Signal Colors |
Color |
btBtn.HighSignalColor = Color.Green;
Distinct colors for LowSignalColor, MediumSignalColor, and HighSignalColor.
|
IconScale |
int | btBtn.IconScale = 110; Scales the central icon size (percentage). Default is 110. |
ChevronWidthFactor |
float | btBtn.ChevronWidthFactor = 1.5f; Controls the width of the directional arrows shown in the Paired state. |
Animations & Effects
Settings for interaction feedback and state transition effects.
| Property | Type | Description & Usage Example |
|---|---|---|
ConnectingAnimationStyle |
ConnectingAnimation |
btBtn.ConnectingAnimationStyle = ConnectingAnimation.Pulse;
Determines the visual loop during connection:
|
EnableRippleEffect |
bool | btBtn.EnableRippleEffect = true; Enables the material-design ink ripple on click. |
EnableSpringEffect |
bool | btBtn.EnableSpringEffect = true; Enables a bouncy scale animation when clicked. |
EnablePressEffect |
bool | btBtn.EnablePressEffect = true; Enables a physical depth depression effect on mouse down. |
Events
Comprehensive event system for handling hardware changes and user interaction.
// Fired when the BluetoothState changes.
btBtn.StateChanged += (sender, e) =>
{
if (e.NewState == BluetoothState.Connected)
{
Console.WriteLine($"Connected to {e.DeviceName}");
}
else if (e.NewState == BluetoothState.Off)
{
MessageBox.Show("Bluetooth is disabled.");
}
};
// Fired when the signal percentage updates.
btBtn.SignalStrengthChanged += (sender, e) =>
{
lblSignal.Text = $"Signal: {e.SignalStrength}%";
if (e.SignalStrength < 30)
{
lblStatus.Text = "Weak Connection";
lblStatus.ForeColor = Color.Red;
}
};
// Fired directly from the background thread monitor.
btBtn.RealTimeStateDetected += (sender, e) =>
{
// Access properties from the EventArgs
var state = e.DetectedState;
var device = e.DeviceName;
Debug.WriteLine($"Monitor Scan: {state} - {device}");
};
Designer Support
The SiticoneBluetoothButton includes a rich Smart Tag panel for rapid configuration.
| Category | Features |
|---|---|
Theme Presets |
Instantly switch between Modern, Light, Dark, Colorful, and Minimal styles. |
Performance |
Toggle Ultra Performance Mode directly from the designer to test low-resource rendering. |
Preview States |
Force the control into specific states (Idle, Connecting, Connected, High Signal, etc.) to preview animations and colors at design time without running the app. |
Quick Actions |
Toggle Secured: Quickly add/remove the lock icon. Reset/Rounded Corners: Adjust border radius presets. Copy/Paste Settings: Duplicate visual styles across multiple buttons. |
Enumerations
public enum BluetoothState
{
Idle, // On but inactive
Off, // Radio disabled
Discoverable, // Visible to other devices
Connecting, // Connection in progress (animated)
Connected, // Connection established
Paired, // Device remembered
Transmitting, // Sending/Receiving data
Low, // Weak signal
Medium, // Fair signal
High, // Strong signal
Error, // Hardware failure
Warning // Driver/Connection warning
}
Detailed Examples
Example 1: Manual State Control
Manually updating the button to reflect an external process.
public async void ConnectToDevice(string deviceId)
{
// Set UI to connecting state
btDevice.State = BluetoothState.Connecting;
btDevice.ConnectingAnimationStyle = ConnectingAnimation.Modern;
try
{
bool success = await _bluetoothService.ConnectAsync(deviceId);
if (success)
{
btDevice.State = BluetoothState.Connected;
btDevice.IsSecured = true; // Show lock icon
}
else
{
btDevice.State = BluetoothState.Warning;
}
}
catch
{
btDevice.State = BluetoothState.Error;
}
}
Example 2: Auto-Detection Monitoring
Enabling the built-in Windows Bluetooth stack monitor.
public void InitializeBluetoothMonitor()
{
// Enable the background thread monitor
btSystem.EnableRealTimeDetection = true;
btSystem.RealTimeMonitoringInterval = 2000; // Poll every 2 seconds
// Handle updates from the OS
btSystem.StateChanged += (s, e) =>
{
if (e.NewState == BluetoothState.Off)
{
lblStatus.Text = "Bluetooth Radio Off";
btnToggle.Text = "Turn On";
}
else
{
lblStatus.Text = $"Radio On - {e.DeviceName}";
btnToggle.Text = "Turn Off";
}
};
}
Example 3: Custom Styling
Creating a unique look by overriding theme defaults.
private void ApplyNeonTheme()
{
// Set theme to Custom to allow overrides
btBtn.Theme = SiticoneBluetoothButton.BluetoothButtonTheme.Custom;
// Neon Green / Cyberpunk aesthetic
btBtn.ActiveColor = Color.Lime;
btBtn.IdleColor = Color.DarkGreen;
btBtn.ConnectingSignalColor = Color.Cyan;
// High contrast borders
btBtn.BorderColor = Color.Lime;
btBtn.BorderThickness = 2;
// Visual adjustments
btBtn.IconScale = 120;
btBtn.ChevronWidthFactor = 2.0f; // Wider arrows
btBtn.EnableRippleEffect = true;
btBtn.RippleColor = Color.FromArgb(100, Color.Lime);
}