Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Enable Copy and Cut in ContextMenu for AutoCompleteBox

Open zrt2399 opened this issue 6 months ago • 3 comments

What does the pull request do?

Enable Copy and Cut in ContextMenu for AutoCompleteBox

What is the current behavior?

image

What is the updated/expected behavior with this PR?

image

How was the solution implemented (if it's not obvious)?

Check if ContextMenu or ContextFlyout is open on lostfocus.

Checklist

  • [ ] Added unit tests (if possible)?
  • [x] Added XML documentation to any related classes?
  • [ ] Consider submitting a PR to https://github.com/AvaloniaUI/avalonia-docs with user documentation

Breaking changes

Obsoletions / Deprecations

Fixed issues

zrt2399 avatar Jun 19 '25 04:06 zrt2399

You can test this PR using the following package version. 12.0.999-cibuild0057135-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Jun 19 '25 05:06 avaloniaui-bot

  • [x] All contributors have signed the CLA.

cla-avalonia avatar Jun 19 '25 05:06 cla-avalonia

@cla-avalonia agree

zrt2399 avatar Jun 19 '25 06:06 zrt2399

You can test this PR using the following package version. 12.0.999-cibuild0057171-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Jun 20 '25 05:06 avaloniaui-bot

You can test this PR using the following package version. 12.0.999-cibuild0057193-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Jun 21 '25 12:06 avaloniaui-bot

Please provide more information on what the current behavior is and why there needs to be a change. Better if you can also make an issue for it.

emmauss avatar Jun 23 '25 13:06 emmauss

Thanks! I've also updated the PR description to reflect the current behavior and the reason for the change. Issue is here: #19117

zrt2399 avatar Jun 25 '25 06:06 zrt2399

New public API for review:

 namespace Avalonia.Controls
 {
     public class AutoCompleteBox
     {
+        public static readonly StyledProperty<bool> ClearSelectionOnLostFocusProperty;
+        public bool ClearSelectionOnLostFocus { get; set; }
     }
 }

MrJul avatar Aug 11 '25 14:08 MrJul

You can test this PR using the following package version. 12.0.999-cibuild0058161-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Aug 12 '25 09:08 avaloniaui-bot

The API already exists on TextBox and has been accepted as is.

MrJul avatar Aug 12 '25 09:08 MrJul