Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Text-Grab/Controls/InlineChipElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public string Value

public event EventHandler? RemoveRequested;

private Button? _removeButton;

static InlineChipElement()
{
DefaultStyleKeyProperty.OverrideMetadata(
Expand All @@ -42,7 +44,15 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();

if (GetTemplateChild(PartRemoveButton) is Button removeButton)
removeButton.Click += (s, e) => RemoveRequested?.Invoke(this, EventArgs.Empty);
if (_removeButton is not null)
_removeButton.Click -= RemoveButton_Click;

_removeButton = GetTemplateChild(PartRemoveButton) as Button;

if (_removeButton is not null)
_removeButton.Click += RemoveButton_Click;
}

private void RemoveButton_Click(object sender, RoutedEventArgs e)
=> RemoveRequested?.Invoke(this, EventArgs.Empty);
}
2 changes: 1 addition & 1 deletion Text-Grab/Controls/InlinePickerRichTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class InlinePickerRichTextBox : RichTextBox

public IEnumerable<InlinePickerItem> ItemsSource
{
get => (IEnumerable<InlinePickerItem>)GetValue(ItemsSourceProperty);
get => (IEnumerable<InlinePickerItem>?)GetValue(ItemsSourceProperty) ?? [];
set => SetValue(ItemsSourceProperty, value);
}

Expand Down
2 changes: 1 addition & 1 deletion Text-Grab/Views/FullscreenGrab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
x:Name="FreeformSelectionMenuItem"
Click="SelectionStyleMenuItem_Click"
Header="Freeform - Draw any shape"
InputGestureText="P"
InputGestureText="D"
IsCheckable="True"
Tag="Freeform" />
<MenuItem
Expand Down
2 changes: 1 addition & 1 deletion Text-Grab/Views/FullscreenGrab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void AddPostGrabActionMenuItem(ContextMenu contextMenu, ButtonInfo actio
Tag = action,
IsChecked = isChecked,
StaysOpenOnClick = stayOpen,
InputGestureText = $"Ctrl+{shortcutIndex}"
InputGestureText = shortcutIndex <= 9 ? $"Ctrl+{shortcutIndex}" : string.Empty
};

menuItem.Click += PostActionMenuItem_Click;
Expand Down
1 change: 1 addition & 0 deletions Text-Grab/Views/QuickSimpleLookup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ private async Task LoadDataGridContent(string csvToOpenPath)
PopulateSampleData();

MainDataGrid.ItemsSource = null;
ItemsDictionary.Clear();

ItemsDictionary.AddRange(ParseStringToRows(contentToParse, true));
lookupItems = [.. ItemsDictionary];
Expand Down