private void ToggleButton_OnClick(object sender, RoutedEventArgs e) { if (ToggleButton.IsChecked.Value) { AutoClosePopup.Show(CheckedMessage); Checked?.Invoke(this, null); ToggleButton.ToolTip = CheckedTooltip; } else { AutoClosePopup.Show(UncheckedMessage); Unchecked?.Invoke(this, null); ToggleButton.ToolTip = UncheckedTooltip; } }
private Button GetCopyButton(string codeToBeCopied) { var button = new Button { Margin = new Thickness(1), Width = 180, Content = $"Copy code {codeToBeCopied}", FontSize = 12, HorizontalAlignment = HorizontalAlignment.Center }; button.Click += (sender, args) => { Clipboard.SetDataObject(codeToBeCopied); AutoClosePopup.Show($"{codeToBeCopied} is copied to clipboard!"); button.Background = Brushes.DarkCyan; }; return(button); }