Exemple #1
0
 private void ToggleButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (ToggleButton.IsChecked.Value)
     {
         AutoCloseNotificationBar.Show(CheckedMessage);
         Checked?.Invoke(this, null);
         ToggleButton.ToolTip = CheckedTooltip;
     }
     else
     {
         AutoCloseNotificationBar.Show(UncheckedMessage);
         Unchecked?.Invoke(this, null);
         ToggleButton.ToolTip = UncheckedTooltip;
     }
 }
Exemple #2
0
        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);
                AutoCloseNotificationBar.Show($"{codeToBeCopied} is copied to clipboard!");
                button.Background = Brushes.DarkCyan;
            };

            return(button);
        }