Skip to content

Setting SelectedItem doesn't select SelectedSegment #105

@tNRevan

Description

@tNRevan

When setting the SelectedItem property of SegmentedControl the correct SelectedSegment with (SegmentedControlOption.)Item equal to SelectedItem is not selected.

Now it really hurts databinding scenario. In my case, I have 3 SegmentedControlOption with Items set to (null), true and false. Text is set to their respective translation in app language. When I databind SelectedItem to either value, nothing changes now - the first SegmentedControlOption is selected regardless of the value.

First of all, selecting SelectedSegment through SelectedItem works only if TextPropertyName is defined. And even if it is defined, it uses equality operator ==, which is really debatable, because usually you want object equality, not reference equality. See SegmentedControl. OnSelectedItemChanged.

I could implement a change, but it would mean slight backward incompatibility, as before SelectedSegment wasn't set when TextPropertyName wasn't defined. But I would consider this more like a bugfix, as it doesn't really make sense to differ between those cases. What do you think about it?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions