Selection.Value does not function correctly when Selection.Values is also used

When only Selection.Value is bound it reports a single value, the oldest selected value, as per the docs.

However, when Selection.Values is also bound, Selection.Value behaves identically, mapping an entire array, instead of just the last selected value.

I have a scenario where I require both:

  • I need to use Selection.Values as you cannot clear a Selection correctly via a Selection.Value binding (this may also be a separate bug)
  • I need Selection.Value so that I can use WhileValue<T> tests within the UX

If this bug is not addressable, is there a workaround allowing me to do both these things? (Can I compare a value inside an array using a WhileValue type, or is there a correct way of clearing Selection via Selection.Value?)

Cheers

If you bind via Value="{mySel}" and do a mySel.clear() in JavaScript that should reset the selection. If that doesn’t work it is a defect (in which case assing an empty string to it instead).

You can also call .clear() directly on the selection itself from JavaScript.

WhileValue is only meant to work on single valued items. If it is bound to Selection.Value and cleared it will just be matching against an empty string. If multiple items are selected however it will match against the first item (based on history of addition).

Assigning an empty string does indeed clear the selection, thanks (I must have been mistaken about this before). .clear() does not, in the case of Selection.Value, so appears to be defect.

Selection.Value becomes an array, not a single value, if Selection.Values is also used. This appears to be a bug (although, granted, I’m not sure in which scenario you would be using both properties)