Fixes #2120. TreeView: Hide cursor in single select mode by default, add cursor toggle to TreeViewFileSystem Scenario#2123
Conversation
…nario TreeViewFileSystem
|
What is the customer scenario where a cursor is useful on Treeview? |
Primary use case is during multi selection to determine where the active row is. Even when multiple rows are selected there is still a 'primary' row which is the one tracked by You can see a similar effect in Visual Studio Code, but in this case the active row has a bright border. I'm happy to go either way on this though. Setting the default to |
Is there another scenario beyond multi-select where it's useful? Perhaps the right thing to do is only enable it when multi-select is active? |
I can't really think another use case other than stylistic choice. Also because there is a public
As I was describing the use case I did think of this but I dislike 'magic' properties (where changing one public property tv.DesiredCursorVisibility = CursorVisibility.Invisible;
tv.MultiSelect = true;To behave differently from: tv.MultiSelect = true;
tv.DesiredCursorVisibility = CursorVisibility.Invisible;Also relevant to this discussion is that MultiSelect defaults to true. Let me know what you want to do, options seem to be:
|
Ok I think I understand... do you mean that |
Right, but take an account the the user may be configured the |
|
Wouldn't it work just to change the /// <summary>
/// Get / Set the wished cursor when the tree is focused.
/// Only applies when <see cref="MultiSelect"/> is true.
/// </summary>
public CursorVisibility DesiredCursorVisibility {
get {
return MultiSelect ? desiredCursorVisibility : CursorVisibility.Invisible;
}
[...] |
|
Probably yes. |
|
@tznind don't forget to call |
…when not MultiSelect
|
Ok I made the following changes of behavior: TreeViewFileSystem now has menu items for toggling:
The changes to TreeView are:
Cursor visibility is set in the |

Fixes #2120- Add cursor toggle to TreeViewFileSystem Scenario
@tig regarding issue #2120, there is already a feature for this (
DesiredCursorVisibility). The default state of this isDefault(i.e. it has a cursor). This PR adds a menu item to the scenario that lets user turn cursor on and off.If you would like the default to be
Invisiblelet me know and I can update this PR.Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)