How to use Apply Legato in the midi editor

Hi. Here is a screenshot before “Apply Legato” applied

here is a screenshot after “Apply Legato” applied

Why is this giving me legato only in some places and not others? I am confused about the functionality about this feature.

I would do your example in two passes. One with the upper triads selected and another pass with the lower notes selected.

Thank you. Yes, this does work, but why? Why can’t I select all of the notes and do it? I can’t understand it.