-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Justification for SubModelSeqSelectedItem #174
Comments
For the initial justification, check out #77 (comment) and following comments.
That's just for simplicity.
Yes, the user would understand |
Thanks for those links. They were very helpful.
Oh, yes. Of course. You are right. I was being dumb there. I understand that now.
That's ok. #77 seems to be specifically about I will look more into |
I am trying to compile a list of controls the involve selection. The implicit assumption is that we want to support all of them.
Anything I missed that I should add? If so, I will edit this comment to add it. |
I think you missed some, and most notably ListBox, though it's sort of covered through its descendant ListView.
ItemsControl is an important visual control in its own right, but does not have support for selection built in. I only wanted it listed as the root in this hierarchy. TreeView has SelectedItem, SelectedValue and SelectedValuePath, despite not being a descendant of Selector. That last fact is most probably due to it not being a plain list. edit: I don't understand why ListBox and ListView (others?) are not a descendants of MultiSelector - but never mind, I don't need to know right now. edit2: I can spend some time this weekend finding relevant controls in DevExpress. I have good hopes they're not that many. |
Wading through the DevExpress documentation on the lookout for components with selection is rather frustrating, but eventually I found these. I won't be surprised if there are more - or if there aren't more. GridControl ListBoxEdit |
Hi, While I know Syncfusion SfDataGrid is already on the list figured I would share my findings. The only form of multi selection supported by SfDataGrid is SelectedItems which ofc does not work with subModelSelectedItem. In single selection the only 2 ways of binding it are using SelectedItem, or using SelectedIndex, there is no SelectedValue or SelectedValuePath. I explored making multi selection work with SfDataGrid, and much like expected there is no way to bind the underlying IsSelected property of rows, like one can do with DataGrid, even submitted a ticket to syncfusion to make sure, here is the reply: https://i.imgur.com/GDXmfmq.png
The provided link does not solve the issue since while GridCheckBoxSelectorColumn is a perfect representation of the desired behaviour, it does not bind to the underlying source (as described in the documentation), have ofc tried to bind it anyway but was unsuccessful. So right now the solution to multiselection on SfDataGrid, is at least as far as I have been able to make work, to have single selection in the wpf control, and then have a checkbox column bound to bool property with a twoway bind, which is the solution @BentTranberg came up with for DevExpress gridcontrol. |
Thanks @MicaelMor for your time spent investigating and sharing your findings. I do intend to eventually add first-class support for multiselect, but I am currently spending my limited time on preparing |
Quoting from the section of the tutorial about
subModelSeqSelectedItem
.Even if this is true, this seems like a minor point to me.
Side note about the veracity of this quote:
What are some controls that satisfy that description? The
SubModelSelectedItem
sample does not use such a control. It usesListView
, which extendsListBox
, which extendsSelector
, which has dependency propertiesSelectedItem
,SelectedValuePath
, andSelectedValue
(as well asSelectedIndex
).Continuing from the previous tutorial quote.
This seems like the central issue to me; we don't want users having to deal with an Elmish.WPF view-model.
SelectedItem
is indeed cumbersome.SelectedValue
is determined bySelectedValuePath
, which is a "path" that is relative toSelectedItem
. Thus,SelectedValue
andSelectedValuePath
are also cumbersome "by association" toSelectedItem
.Theresore, it doesn't matter so much if...
We (currently) have two types of sequence binginds:
OneWaySeq
andSubModelSeq
.OneWaySeq
, the type in the user's sequence is the same type in theObservableCollection<>
that is bound toItemSource
, which is the same type asSelectedItem
andSelectedValue
, so the user understands the value of those properties as well as the values ofSelectedValuePath
andDisplayMemberPath
.SubModelSeq
, the type in theObservableCollection<>
that is bound toItemSource
is a view-model dynamically defined by Elmish.WPF, so the user will not understandSelectedItem
,SelectedValue
,SelectedValuePath
, orDisplayMemberPath
(nor do we want users interacting with our internal view-model type).The main reason for the existence of
SubModelSeqSelectedItem
is to give the users a clear and legitimate way to interactive with the selected item of theirSubModelSeq
binding.Am I understanding this correctly?
As an alternative to
SubModelSeqSelectedItem
, maybe users could use aTwoWay
binding withSelectedIndex
. However, just after writing that, I see an issue. Suppose a message causes something to be added to the beginning of the list. This increases the selected index by one, which results in the dispatch of another message to correct the selected index. In the meantime, the model is inconsistent and there could be queued messages waiting to be processed. I think the moral of that story is that the context in which an index is also an ID is very narrow.The text was updated successfully, but these errors were encountered: