Browse Source
Merge pull request #10191 from Gillibald/fixes/InlineUIContainerLogical
Propertly handle an InlineUIContainer's logical children
pull/10271/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with
27 additions and
17 deletions
-
src/Avalonia.Controls.DataGrid/DataGrid.cs
-
src/Avalonia.Controls.DataGrid/Utils/TreeHelper.cs
-
src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
-
src/Avalonia.Controls/Control.cs
-
src/Avalonia.Controls/Documents/InlineUIContainer.cs
-
src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
-
src/Avalonia.Controls/Primitives/OverlayPopupHost.cs
-
src/Avalonia.Controls/Primitives/Popup.cs
-
src/Avalonia.Controls/Primitives/PopupRoot.cs
-
src/Avalonia.Controls/ProgressBar.cs
-
src/Avalonia.Controls/TextBlock.cs
|
|
|
@ -3979,7 +3979,7 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
if (focusedObject is Control element) |
|
|
|
{ |
|
|
|
parent = element.Parent; |
|
|
|
parent = element.VisualParent; |
|
|
|
if (parent != null) |
|
|
|
{ |
|
|
|
dataGridWillReceiveRoutedEvent = false; |
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ namespace Avalonia.Controls.Utils |
|
|
|
{ |
|
|
|
if (child is Control childElement) |
|
|
|
{ |
|
|
|
parent = childElement.Parent; |
|
|
|
parent = childElement.VisualParent; |
|
|
|
} |
|
|
|
} |
|
|
|
child = parent; |
|
|
|
|
|
|
|
@ -792,7 +792,7 @@ namespace Avalonia.Controls |
|
|
|
Control? element = focused as Control; |
|
|
|
if (element != null) |
|
|
|
{ |
|
|
|
parent = element.Parent; |
|
|
|
parent = element.VisualParent; |
|
|
|
} |
|
|
|
} |
|
|
|
focused = parent; |
|
|
|
|
|
|
|
@ -2,14 +2,12 @@ using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using Avalonia.Automation.Peers; |
|
|
|
using Avalonia.Controls.Documents; |
|
|
|
using Avalonia.Controls.Primitives; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Input.Platform; |
|
|
|
using Avalonia.Interactivity; |
|
|
|
using Avalonia.LogicalTree; |
|
|
|
using Avalonia.Media; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Styling; |
|
|
|
using Avalonia.Threading; |
|
|
|
@ -211,8 +209,6 @@ namespace Avalonia.Controls |
|
|
|
remove => RemoveHandler(SizeChangedEvent, value); |
|
|
|
} |
|
|
|
|
|
|
|
public new Control? Parent => (Control?)base.Parent; |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
bool IDataTemplateHost.IsDataTemplatesInitialized => _dataTemplates != null; |
|
|
|
|
|
|
|
|
|
|
|
@ -64,5 +64,23 @@ namespace Avalonia.Controls.Documents |
|
|
|
internal override void AppendText(StringBuilder stringBuilder) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) |
|
|
|
{ |
|
|
|
base.OnPropertyChanged(change); |
|
|
|
|
|
|
|
if (change.Property == ChildProperty) |
|
|
|
{ |
|
|
|
if(change.OldValue is Control oldChild) |
|
|
|
{ |
|
|
|
LogicalChildren.Remove(oldChild); |
|
|
|
} |
|
|
|
|
|
|
|
if(change.NewValue is Control newChild) |
|
|
|
{ |
|
|
|
LogicalChildren.Add(newChild); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -553,7 +553,7 @@ namespace Avalonia.Controls.Platform |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected static IMenuItem? GetMenuItem(Control? item) |
|
|
|
protected static IMenuItem? GetMenuItem(StyledElement? item) |
|
|
|
{ |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
set { /* Not currently supported in overlay popups */ } |
|
|
|
} |
|
|
|
|
|
|
|
protected internal override Interactive? InteractiveParent => Parent; |
|
|
|
protected internal override Interactive? InteractiveParent => (Interactive?)VisualParent; |
|
|
|
|
|
|
|
public void Dispose() => Hide(); |
|
|
|
|
|
|
|
|
|
|
|
@ -723,7 +723,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
while (e is object && (!e.Focusable || !e.IsEffectivelyEnabled || !e.IsVisible)) |
|
|
|
{ |
|
|
|
e = e.Parent; |
|
|
|
e = e.VisualParent as Control; |
|
|
|
} |
|
|
|
|
|
|
|
if (e is object) |
|
|
|
|
|
|
|
@ -72,12 +72,12 @@ namespace Avalonia.Controls.Primitives |
|
|
|
/// <remarks>
|
|
|
|
/// Popup events are passed to their parent window. This facilitates this.
|
|
|
|
/// </remarks>
|
|
|
|
protected internal override Interactive? InteractiveParent => Parent; |
|
|
|
protected internal override Interactive? InteractiveParent => (Interactive?)Parent; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the control that is hosting the popup root.
|
|
|
|
/// </summary>
|
|
|
|
Visual? IHostedVisualTreeRoot.Host => Parent; |
|
|
|
Visual? IHostedVisualTreeRoot.Host => VisualParent; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the styling parent of the popup root.
|
|
|
|
|
|
|
|
@ -231,7 +231,7 @@ namespace Avalonia.Controls |
|
|
|
private void UpdateIndicator() |
|
|
|
{ |
|
|
|
// Gets the size of the parent indicator container
|
|
|
|
var barSize = _indicator?.Parent?.Bounds.Size ?? Bounds.Size; |
|
|
|
var barSize = _indicator?.VisualParent?.Bounds.Size ?? Bounds.Size; |
|
|
|
|
|
|
|
if (_indicator != null) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -673,8 +673,6 @@ namespace Avalonia.Controls |
|
|
|
controlRun.Control is Control control) |
|
|
|
{ |
|
|
|
VisualChildren.Remove(control); |
|
|
|
|
|
|
|
LogicalChildren.Remove(control); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -693,8 +691,6 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
VisualChildren.Add(control); |
|
|
|
|
|
|
|
LogicalChildren.Add(control); |
|
|
|
|
|
|
|
control.Measure(Size.Infinity); |
|
|
|
} |
|
|
|
} |
|
|
|
|