* fix: 17453 don't lose text selection when contextmenu opens on another control
* fix: 17453 don't effect other callers and move the check to FocusChanged method
* Always measure TextBlock with infinite width
* Make sure the constraint is always fulfilled
* Add some tests
* Adjust tests because we no longer retain the TextLayout in the arrange pass
* fix accelerator behavior for menu items and labels
* add elements with matching accelerator to test cycling in sub menus
* Add AccessKeyHandler tests for accelerators with more than one match
* Implement accelerator behavior based on WPF handling
* Remove commented code
* Remove OnAccessKey override => handled by DefaultMenuInteractionHandler
* remove obsolete test
* handle OnAccessKeyPressed for selected tab item
* fix unit tests
* use AccessKeyEvent instead of AccessKeyPressedEvent in unit tests
* navigate menu with and without ALT key
* Revert formatting changes in Tests
* Fix AccessKeyHandler comments
* move private types to bottom
* Remove lock statements, optimize removal of AccessKeyRegistrations
* remove call to Dispatcher.UIThread.Post
* simplifiy AccessKeyHandler.SortByHierarchy
* remove unnecessary method AccessKeyHandler.GetTargetsForSender
* regenerate API suppression file
* revert unneeded changes in MenuPage.axaml
* correct formatting changes
* do not sort by hierarchy if too few targets
* make AccessKeyEventArgs internal
* make AccessKeyPressedEventArgs internal
---------
Co-authored-by: Hans Docsek <hans.docsek@gmail.com>
* Add failing test for TemplateBinding inside custom control template
* Fix TemplateBinding XAML compilation error for custom IControlTemplate
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Fix InlineDictionary Behavior for Single Item Reassignment
Previous Behavior:
- When the `Set` method was called, it ignored the `overwrite` parameter if the dictionary contained only one item.
- This caused the `Set` method to behave like the `Add` method, leading to unexpected behavior in composition animations.
- Specifically, the second composition animation would not play because it could not replace the first animation. Instead, it was added after the first animation, preventing it from being executed.
Updated Behavior:
- The `InlineDictionary` now respects the `overwrite` parameter even when it contains only one item.
- This ensures that the second composition animation can overwrite the first one, allowing it to play correctly.
* Append unit test for InlineDictionary
* keep the `(TKey)_data` in a variable and reuse it below line 90 so we avoid a double cast
* Rename the test method
* Remove the unnecessary assignment code.
* Do not reset the selected range when the TextBox loses focus
Do not render selection highlight when the TextBox doesn't has focus
* Invalidate TextLayout when the focus is lost
* Make ClearSelectionAfterFocusLost optional
Make inactive selection highlight optional
* Make sure changes to ShowSelectionHighlight invalidate the visual and text layout
* Add failing focus tests for flyouts inside overlay popups
* Implement IKeyboardNavigationHandler on OverlayPopupHost
* Layout OverlayPopupHost content for focus to work
* Rework how TextBlock skips redundant measure and arrange calls
Add some tests
* Adjust tests
* Try this
* Make sure the TextBlock is arranged after it has been measured with a different availableSize
* Make it more clear that we are resetting and recreating the TextLayout
* Capture textLayout after inlines have been processed
* Set TimePickerPresenter.Time seconds component to zero when UseSeconds is false
* Remove unneeded PART_FirstSpace annotation from TimePickerPresenter
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* Fix DataGrid native aot crash when sorting.
* Update DataGridSortDescription.cs
* add customType test
* does not crash when property type is not sortable.
* check `RuntimeFeature.IsDynamicCodeSupported` to fallback to reflection implemention
* Only check MainWindow visiblity in DoShutdown cancellation, when ShutdownMode == ShutdownMode.OnMainWindowClose
* Raise WindowClosedEvent event AFTER IsVisible/_shown properties were updated
* Add OnMainWindowClose cancellation tests
* Assert that Closing event was actually raised.
* Re-do fix by forcing window closing
* Forced .Shutdown() should also raise Window.Closed events, and not ignore them
* Try to infer DataContext type from #named binding nodes
* Try to infer DataContext type from $parent binding nodes
* Use new syntax in the repo (Rider still marks it as an error)
* Add tests ensuring type casing still works
* Fix $parent regression
* Make new tests StringSyntax compatible
* removed duplicated code between Window.Show and Window.ShowDialog
* Handling different cases of window initial position and size + unit test
* positioning cursor on resize grip in WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_Clicking_Resize_Grip test
* Fix for flaky test
* displaying decimal digits of slider value to avoid some issues with rounding
---------
Co-authored-by: Herman Kirshin <herman.kirshin@jetbrains.com>
* Always Return 0 bidi level for TextEndOfLine run
* Fix test unit
* Expand the unit test
---------
Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* ComboBox empty selection should not generate a TextBlock as SelectionBoxItem
Fixes: #16747
* Add test for ComboBox DisplayMemberBinding behavior without selection.
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* test: Check that `SplitButton.Click` is not fired when `SplitButton` is not in focused
* fix: `SplitButton.Click` is not fired when `SplitButton` is not in focused
* fix: Address review
* fix: Address review
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* feat: Allow use of (Classes.`classname`) syntax on Style and ControlTheme Setter elements
* feat: Add Selector validation
* test: Check binding Classes in Setter
* test(SplitViewTests.cs): added failing test for issue #17176
* fix(SplitView.cs): added pane state pseudo class update in OnApplyTemplate
- fixed#17176
* test(SplitViewTests): added globalclock mock to failing test
* Show Avalonia context menu and toolip...
In native text box in integration test app. Only implemented for win32 right now.
This is to test the two popup behaviors required for native controls:
- The context menu needs focus to be transferred to Avalonia
- The ToolTip must not transfer focus to Avalonia
* Added Popup.TakesFocusFromNativeControl.
By default, if a popup is shown when a native control is focused, focus is transferred back to Avalonia in order for the popup to receive input. If this property is set to false, then the shown popup will not receive input until it receives an interaction which explicitly focuses the popup, such as a mouse click.
The effect of this property can be seen in the Embedding tag of the IntegrationTestApp: hovering over the native text box shows an Avalonia `ToolTip` which does not steal focus from the native text box. Right-clicking to open an Avalonia `ContextMenu` does steal focus so the menu items can be selected using the arrow keys.
Currently only implemented on a win32.
* Show tooltip and context menu on macOS.
* Implement TakeFocus on macOS.
* Add integration tests.
Only tested on win32 so far.
* Integration tests won't work on macOS.
As can be expected at this point, really.
* Update API diff.
* Fix HeadlessWindowImpl.Position does not persist new value
* Create unit-test for 17071 fix
* Fix CI errors
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Add failing test for #16746
* Always read the value from the target object.
The value must be read from the target object instead of using the value from the event because the value may have changed again between the time the event was raised and now: if that occurs in a two-way binding then we end up with a stack overflow.
* Added failing AutoCompleteBox test.
* Make sure that flags are reset if exits early.
Wrap everything in a `try`...`finally` block so that they get reset even on exception.
* Use scalable rasterization for visual brush
* Make ConfigureSceneBrushContentWithPicture less byzantine
---------
Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
* Enable VisualBrush to be used as Visual's OpacityMask
* Add missing test file
---------
Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
* Implement AvaloniaObject on ResourceProvider
* ColorPaletteResources and ColorPaletteResourcesCollection should inherit ResourceProvider
* Use ResourceProvider in tests too
* Adjust API diff
---------
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
* Make sure wrapper and platform DrawingContext have the same transform after Flush
* Add some tests
* Update Avalonia.RenderTests.WpfCompare.csproj
* Remove comments
* Use test font
* Stop Selection.Clear() when selecting a range to enable multiple consecutive blocks to be selected.
* Reinstated Selection.Clear() when range is true and toggleModifier is false.
When range and toggleModifier are true, consecutive ranges are selected.
Added new unit test.
The typo causes the resources `implicitSharedInstance1` and `implicitSharedInstance2` are both always `AvaloniaProperty.UnsetValue`, where `Assert.Same` passes.
* Add CustomPopupPlacement API
* Add Placement="Custom" support for Flyout, ToolTip and ContextMenu controls as well
* Adjust some API changes
* Add Avalonia.Controls.Primitives.IPopupHost.ConfigurePosition breaking change
* Extract new types into separated files
* Fix build after merge conflict
* Adjust nupkg.xml
* Dispose property subscriptions after popup is closed, avoiding flickering
* Adjust API to be more future proof and add new parameters.
* Add new ContextRequestedEventArgs overload while I am on it