ak2yny / OpenHeroSelectGUI

GUI for OpenHeroSelect based on MUAOpenHeroSelect by adamatti
GNU General Public License v3.0
4 stars 1 forks source link

Selected Characters Swipe Delete Not Working as Intended #20

Closed ak2yny closed 8 months ago

ak2yny commented 9 months ago

The swipe control is currently added as a layer underneath the list view items. This is a bug, because The item itself isn't swiped. The only visual indicator of the swipe is the red bar in the background. And that bar width is limited to 300.

https://github.com/ak2yny/OpenHeroSelectGUI/blob/5705031878b8906e0091e66765d28676101481e7/cs_source/SelectedCharacters.xaml#L12-L40

The width limit (MaxWidth) was added to prevent the swipe control from requesting the MaxWidth of the frame (page). If added as supposed (with the grid containing the list items being a child of the swipe control) then the result is like this:

The desired result (current) is this:

image

Other attempts to solve the issue all seem to negate the Width properties of the column definition

ak2yny commented 8 months ago

It comes down to a clash with SwipeControl and a Grid in following manner:

<Grid>
    <Grid.ColumDefinitions>
        <ColumDefinition Width="Auto">
        <ColumDefinition>
    </Grid.ColumDefinitions>
</Grid>

The second column (or any column without width definition) expands to the available size, but in a non-greedy manner. It does it in a greedy manner, however, if the content requests it. Now, since the grid is no longer a child of the (ListView in this case), but of swipe control, it gets the available size of the swipe control, which itself just adjusts to the size of its content. With such a column that expands to the available size, the swipe control gives that available size but in a greedy fashion, not aware what the desired or previous behaviour is. This is not a real bug, but in all my tests, I found no way to use left and right aligned content with a non-greedy middle.

However, I can use the last column with the smaller right-aligned items as the expandable, non-greedy column and exclude it from the swipe item. It seems like the swipe item reacts to the whole list view item, regardless. The right-aligned items don't move when swiped, but the result still looks pretty decent.

This is my chosen solution, coming with the next update.