From bad21de73df9ea84748952418f3eb6c73943d9d9 Mon Sep 17 00:00:00 2001 From: Stepan Pilipenko Date: Tue, 18 Nov 2025 20:31:04 +0300 Subject: [PATCH] dispatch + fix --- MainPage.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MainPage.xaml.cs b/MainPage.xaml.cs index 41c683a..0f406d2 100644 --- a/MainPage.xaml.cs +++ b/MainPage.xaml.cs @@ -242,7 +242,7 @@ public partial class MainPage : ContentPage, INotifyPropertyChanged _isLeftPanelActive = false; System.Diagnostics.Debug.WriteLine($"R !!! {_rightSelectedIndex} {_lastRightSelectedIndex}"); - if (_rightSelectedIndex < RightItems.Count && _rightSelectedIndex >= 0) + if (_lastRightSelectedIndex < RightItems.Count && _lastRightSelectedIndex >= 0) { // Автоматически переключаем фокус при достижении границ if (_rightSelectedIndex > _lastRightSelectedIndex) @@ -289,8 +289,8 @@ public partial class MainPage : ContentPage, INotifyPropertyChanged private void SetFocusToItem(CollectionView collectionView, FileSystemItem item) { // Используем Dispatcher чтобы дождаться рендеринга - //Dispatcher.Dispatch(() => - //{ + Dispatcher.Dispatch(() => + { var container = FindButtonContainer(collectionView, item); if (container is Button button) { @@ -311,7 +311,7 @@ public partial class MainPage : ContentPage, INotifyPropertyChanged // Прокручиваем к выбранному элементу collectionView.ScrollTo(item, position: ScrollToPosition.MakeVisible, animate: false); } - //}); + }); } private Button? FindButtonContainer(CollectionView collectionView, FileSystemItem item)