FindMyFiles

FindMyFiles.Controls

ResultsViewportManager Class

Imperative ListView companion for the results list: viewport placement after each published result, best-effort selection restore across seeded Resets, ScrollViewer discovery, and the selection-driven row actions (open / reveal / copy — all via ShellOps, which sheds elevation through explorer.exe).

UI thread only: every member touches the ListView, and the class is constructed and wired from the page constructor on the UI thread. The pure decision helpers (FindMyFiles.Controls.ResultsViewportManager.CanRestoreViewport(System.Nullable{System.Int32},System.Int32), FindMyFiles.Controls.ResultsViewportManager.FindSelectionIndex(System.Func{System.Int32,System.Object},System.Int32,System.Int32,System.Int32,System.UInt64), FindMyFiles.Controls.ResultsViewportManager.CopyablePaths(System.Collections.IEnumerable)) are static and unit-tested without a ListView.

public sealed class ResultsViewportManager

Inheritance System.Object → ResultsViewportManager

Constructors

ResultsViewportManager(ListView) Constructor

Wrap the results list and start tracking its selection so the last real (non-placeholder) row's engine identity (EntryRef) can be re-found and reselected after a position-preserving requery's Reset clears the ListView selection.

public ResultsViewportManager(Microsoft.UI.Xaml.Controls.ListView list);

Parameters

list Microsoft.UI.Xaml.Controls.ListView

The results ListView to wrap and track.

Methods

ResultsViewportManager.CopySelectedPaths() Method

Copy the full paths of all real selected rows to the clipboard, CRLF-separated; no-op when the selection holds no real rows.

public void CopySelectedPaths();

ResultsViewportManager.FocusTopRow() Method

Down from the search box: focus the list on its top row.

public void FocusTopRow();

ResultsViewportManager.OnResultsPublished(ResultsPublication) Method

Reset origins (typing, sort…) land at the top; position-preserving origins (index changed, stale…) restore the previous first visible row and, best effort, the selection. Explicit placement — the ListView's own behavior after a Reset is version-dependent.

public void OnResultsPublished(FindMyFiles.ViewModels.ResultsPublication pub);

Parameters

pub ResultsPublication

The freshly published result and its restore hints.

ResultsViewportManager.OpenSelected() Method

Open the selected row's file via the shell (no-op if nothing or a placeholder is selected).

public void OpenSelected();

ResultsViewportManager.OpenSelectedOrTop() Method

Open the selected row, or the top row when none is selected (Enter from the search box).

public void OpenSelectedOrTop();

ResultsViewportManager.RevealSelected() Method

Reveal the selected row's file in Explorer (selected in its folder); no-op for an empty or placeholder selection.

public void RevealSelected();

ResultsViewportManager.SelectedOrTopRow() Method

The selected row, falling back to the top row — what Enter from the search box opens when the user never moved into the list.

public FindMyFiles.ViewModels.ResultRow? SelectedOrTopRow();

Returns

ResultRow
The selected row, the top row, or null when empty.

ResultsViewportManager.SelectedRow() Method

The currently selected row, or null if nothing (or a non-row) is selected.

public FindMyFiles.ViewModels.ResultRow? SelectedRow();

Returns

ResultRow
The selected ResultRow, or null.