🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Parsed/VCurrent and vSelected
This page was created by PageReplicator on 2025-09-01. Last edited by PageReplicator on 2025-09-01.

Template:Notice



<a href="/Documentation:ViewModel" title="Documentation:ViewModel" data-bs-title="Documentation:ViewModel">ViewModels</a> create and maintain vCurrent_ and vSelected_ variables for each level of your ViewModel-nestings.

The values maintained by the Framework reflect what the user has focused on/clicked last (vCurrent_), and when you allow multi-select in grids, the vSelected_ collection is maintained.

The variables are strongly typed to match your <a href="/Documentation:Nestings" title="Documentation:Nestings" data-bs-title="Documentation:Nestings">nestings</a> and get the postfix name from the nesting.

See this article for a fuller discussion on <a href="/Documentation:Cursored_or_Full_Tree" title="Documentation:Cursored or Full Tree" data-bs-title="Documentation:Cursored_or_Full_Tree">how to cursor your ViewModel</a>.

See also: <a href="/Documentation:How_to_use_vCurrent_and_%E2%80%9Cself%E2%80%9D_correctly_in_viewmodels" title="Documentation:How to use vCurrent and “self” correctly in viewmodels" data-bs-title="Documentation:How_to_use_vCurrent_and_“self”_correctly_in_viewmodels">How to use vCurrent and “self” correctly in viewmodels</a>

Auto select first row[<a href="/index.php?title=Documentation:VCurrent_and_vSelected&veaction=edit&section=1" class="mw-editsection-visualeditor" title="Edit section: Auto select first row" data-bs-title="Documentation:VCurrent_and_vSelected">edit</a> | <a href="/index.php?title=Documentation:VCurrent_and_vSelected&action=edit&section=1" title="Edit section: Auto select first row" data-bs-title="Documentation:VCurrent_and_vSelected">edit source</a>]

In WebUI DataGrids, we AutoSelectFirstRow if the list has not set MultiSelect. If you, however, do use MultiSelect, the default is to not AutoSelectFirstRow. This behavior can be controlled by explicitly setting Nesting.AutoSelectFirstRow to true or false.

Update vSelected maintaince in Turnkey[<a href="/index.php?title=Documentation:VCurrent_and_vSelected&veaction=edit&section=2" class="mw-editsection-visualeditor" title="Edit section: Update vSelected maintaince in Turnkey" data-bs-title="Documentation:VCurrent_and_vSelected">edit</a> | <a href="/index.php?title=Documentation:VCurrent_and_vSelected&action=edit&section=2" title="Edit section: Update vSelected maintaince in Turnkey" data-bs-title="Documentation:VCurrent_and_vSelected">edit source</a>]

Complex issue with vSelected in Turnkey: when you have not checked the SelectedBox - you may want the vCurrent to be part of the vSelected - but then, you want it removed from vSelected if the only reason for being in vSelected was that it was vCurrent.

This issue is not complex in WPF because there is a natural difference between the focused and selected. UI controls automatically include the focused in the selected collection - but, on the web, we have the extra checkbox and we must know the reason for being in vSelected. Is it only because we were vCurrent before - and thus should we be removed from vSelected?

   <iframe src="https://www.youtube.com/embed/u-qeBxf99R4?si=1rRQMYB8MLtThcvw" title="YouTube video player" frameborder="0" allowfullscreen=""></iframe>