Skip to content

Instantly share code, notes, and snippets.

@smailliwcs
Created September 22, 2020 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smailliwcs/5fc94cb4db377aeba40adcd1aa19df0d to your computer and use it in GitHub Desktop.
Save smailliwcs/5fc94cb4db377aeba40adcd1aa19df0d to your computer and use it in GitHub Desktop.
Clearable WPF radio buttons
using System.Windows.Controls;
public class ClearableRadioButton : RadioButton
{
protected override void OnClick()
{
bool? wasChecked = IsChecked;
base.OnClick();
if (wasChecked.GetValueOrDefault())
{
IsChecked = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment