Elmish.WPF icon indicating copy to clipboard operation
Elmish.WPF copied to clipboard

SubModelSeq deselects items when moving

Open cmeeren opened this issue 4 years ago • 6 comments

In the SubModelSeq sample, when moving counters up/down, they are deselected. I don't think that happened before. Unless I'm mistaken, it would be good if we could bring back that behavior.

(This is not critical and not something I will prioritize looking into myself.)

cmeeren avatar Nov 29 '20 13:11 cmeeren

I can fix this

TysonMN avatar Nov 29 '20 16:11 TysonMN

I think the proper way to do this is to store the selected item in the model. That is not currently happening.

Specifically looking at the TreeView in the head of master... https://github.com/elmish/Elmish.WPF/blob/8e8d3b00f6ec728943a51497f5af17348963fe07/src/Samples/SubModelSeq.Views/MainWindow.xaml#L23

...and a bit of git history for the corresponding file, I don't think there ever was a binding to SelectedItem. Maybe a previous version of the code maintained the selected item by somewhat coincidently storing the selected item in WPF.

TysonMN avatar Dec 02 '20 19:12 TysonMN

Maybe a previous version of the code maintained the selected item by somewhat coincidently storing the selected item in WPF.

Yes, I think that's correct. It just worked. I'm curious why that is no longer the case. Are you able and willing to investigate that? It's not critical, but if we could restore that behavior, so that we don't have to "bog down" the app logic with managing the selected item, I think that would be best.

As a bonus, this could teach us something about the interplay of Elmish.WPF and WPF. There is evidently something going on here we don't yet understand.

cmeeren avatar Dec 02 '20 20:12 cmeeren

Are you able and willing to investigate that?

Definitely willing. I will find the time, but not right away.

TysonMN avatar Dec 02 '20 21:12 TysonMN

Has something happened (edit: happened to WPF) going from .NET Framework to .NET Core / .NET 5 ? Regression or intended changes? Is this related to #440 ? I have had a feeling several times that there are subtle changes in this area in WPF.

BentTranberg avatar Nov 04 '21 01:11 BentTranberg

In v3.5.5 and older, selection is kept when moving up and down, except when the selected item is at the top or bottom of the list and another is moved into its position, in which case the replacing item receives selection.

LyndonGingerich avatar Apr 22 '22 23:04 LyndonGingerich