using System.Windows;
using System.Windows.Controls.Primitives;
namespace Artemis.UI.Shared
{
///
/// Represents a toggle button that can be locked using a property
///
public class LockableToggleButton : ToggleButton
{
///
/// Gets or sets a boolean indicating whether the toggle button is locked
///
public static readonly DependencyProperty IsLockedProperty =
DependencyProperty.Register("IsLocked", typeof(bool), typeof(LockableToggleButton), new UIPropertyMetadata(false));
///
/// Gets or sets a boolean indicating whether the toggle button is locked
///
public bool IsLocked
{
get => (bool) GetValue(IsLockedProperty);
set => SetValue(IsLockedProperty, value);
}
///
protected override void OnToggle()
{
if (!IsLocked) base.OnToggle();
}
}
}