fix: ensure indicator is visibility upon loaded.
This commit is contained in:
@@ -14,6 +14,7 @@ public partial class SelectionListDemoViewModel: ObservableObject
|
|||||||
{
|
{
|
||||||
"Ding", "Otter", "Husky", "Mr. 17", "Cass"
|
"Ding", "Otter", "Husky", "Mr. 17", "Cass"
|
||||||
};
|
};
|
||||||
|
SelectedItem = Items[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Controls.Selection;
|
using Avalonia.Controls.Selection;
|
||||||
using Avalonia.Controls.Templates;
|
using Avalonia.Controls.Templates;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Rendering.Composition;
|
using Avalonia.Rendering.Composition;
|
||||||
using Avalonia.Rendering.Composition.Animations;
|
using Avalonia.Rendering.Composition.Animations;
|
||||||
using Irihi.Avalonia.Shared.Helpers;
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
@@ -95,6 +96,18 @@ public class SelectionList: SelectingItemsControl
|
|||||||
EnsureIndicatorAnimation();
|
EnsureIndicatorAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoaded(e);
|
||||||
|
if(_indicator is not null && SelectedItem is not null)
|
||||||
|
{
|
||||||
|
var container = ContainerFromItem(SelectedItem);
|
||||||
|
if (container is null) return;
|
||||||
|
_indicator.Opacity = 1;
|
||||||
|
_indicator.Arrange(container.Bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void EnsureIndicatorAnimation()
|
private void EnsureIndicatorAnimation()
|
||||||
{
|
{
|
||||||
if (_indicator is not null)
|
if (_indicator is not null)
|
||||||
|
|||||||
Reference in New Issue
Block a user