rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
742 stars 93 forks source link

Combobox listitems in ScrollViewer doesn't follow combobox #344

Open LuckyScamper opened 3 years ago

LuckyScamper commented 3 years ago

To reproduce:

  1. open combobox
  2. scroll upwards in the vertical scrollviewer
      <ScrollViewer Padding="16" Width="600">
        <Grid RowSpacing="16" ColumnSpacing="8" VerticalAlignment="Center" Padding="32" Width="500">
          <Grid.DefaultColumnProportion Type="Fill" />
          <Grid.DefaultRowProportion Type="Auto" />
          <Label    StyleName="Title-subtext"       GridRow="0" L18nTextKey="gameplay" TextAlign="Center" HorizontalAlignment="Center" />
          <CheckBox AudioEffectsName="metalbuttons" Id="MinimizeZipCheckbox" GridRow="1" L18nTextKey="minimize_zip" TextAlign="Center" HorizontalAlignment="Center" />
          <CheckBox AudioEffectsName="metalbuttons" Id="AutosaveCheckbox" GridRow="2" L18nTextKey="autosave" TextAlign="Center" HorizontalAlignment="Center" />
          <Label  StyleName="Title-h3" GridRow="3" L18nTextKey="choose_language" TextAlign="Center" HorizontalAlignment="Center" />
          <ComboBox AudioEffectsName="metalbuttons" Id="LanguageComboBox" GridRow="4" HorizontalAlignment="Center" ContentHorizontalAlignment="Center" SelectedIndexChanged="OnLanguageChanged">
            <ListItem Text="English" Id="en" />
            <ListItem Text="Deutsch" Id="de" />
            <ListItem Text="Nederlands" Id="nl" />
            <ListItem Text="Français" Id="fr" />
          </ComboBox>
          <Label  StyleName="Title-subtext"       GridRow="5" L18nTextKey="audio" TextAlign="Center" HorizontalAlignment="Center" />
          <Label  StyleName="Title-h3" GridRow="6" L18nTextKey="master_volume" TextAlign="Center" HorizontalAlignment="Center" />
          <HorizontalSlider Id="MasterVolume" AudioEffectsName="metalbuttons" GridRow="7" Maximum="1" ValueChangedByUser="MasterVolumeChanged" HorizontalAlignment="Center" />
          <Label  StyleName="Title-h3" GridRow="8" L18nTextKey="music_volume" TextAlign="Center" HorizontalAlignment="Center" />
          <HorizontalSlider Id="MusicVolume" AudioEffectsName="metalbuttons" GridRow="9" Maximum="1" ValueChangedByUser="MusicVolumeChanged" HorizontalAlignment="Center" />
          <Label  StyleName="Title-h3" GridRow="10" L18nTextKey="sfx_volume" TextAlign="Center" HorizontalAlignment="Center" />
          <HorizontalSlider Id="SfxVolume" AudioEffectsName="metalbuttons" GridRow="11" Maximum="1" ValueChangedByUser="SfxVolumeChanged" HorizontalAlignment="Center" />
          <Label  StyleName="Title-h3" GridRow="12" L18nTextKey="ambient_volume" TextAlign="Center" HorizontalAlignment="Center" />
          <HorizontalSlider Id="AmbientVolume" AudioEffectsName="metalbuttons" GridRow="13" Maximum="1" ValueChangedByUser="AmbientVolumeChanged" HorizontalAlignment="Center" />

          <Label  StyleName="Title-h3" GridRow="14" L18nTextKey="resolution" TextAlign="Center" HorizontalAlignment="Center" />
          <ComboBox AudioEffectsName="metalbuttons" Id="ScreenSizes" HorizontalAlignment="Center" ContentHorizontalAlignment="Center" GridRow="15" SelectedIndexChanged="OnScreenSizeChanged" >
          </ComboBox>
          <CheckBox AudioEffectsName="metalbuttons" Id="MinimizeZipCheckbox" GridRow="16" L18nTextKey="fullscreen" TextAlign="Center" HorizontalAlignment="Center" />
          <Button AudioEffectsName="metalbuttons" Click="RevertChanges" L18nTextKey="revert_changes" StyleName="MenuButton" GridRow="17" HorizontalAlignment="Center" ContentHorizontalAlignment="Center" />
          <Button AudioEffectsName="metalbuttons" Click="ApplyChanges" L18nTextKey="apply_changes" StyleName="MenuButton" GridRow="18" HorizontalAlignment="Center" ContentHorizontalAlignment="Center" />
        </Grid>
      </ScrollViewer>    
    </HorizontalSplitPane>

Evidence

rds1983 commented 3 years ago

Is it reproducable with MML that uses default stylesheet?

LuckyScamper commented 3 years ago

should be. I haven't done anything unusual in the stylesheet

  <ScrollViewerStyles>
    <ScrollViewerStyle HorizontalScrollBackground="HorizontalSlider" HorizontalScrollKnob="Button_Round_Normal" VerticalScrollBackground="VerticalSlider" VerticalScrollKnob="Button_Round_Normal" />
  </ScrollViewerStyles>

    <ComboBoxStyle Background="ComboBox_Normal" OverBackground="ComboBox_Pressed" Width="128" Height="32">
      <LabelStyle Font="Trattatello-h4" Padding="8, 0" TextColor="white" />
      <ListBoxStyle Height="128">
        <ListItemStyle Background="ListBox_Normal" OverBackground="ListBox_Pressed" Width="128" Height="32">
          <LabelStyle Font="Trattatello-h4" Padding="8, 0" TextColor="white" />
        </ListItemStyle>
      </ListBoxStyle>
    </ComboBoxStyle>
  </ComboBoxStyles>
rds1983 commented 3 years ago

Considering that there are attrs like "L18nTextKey", I take it that the bug is reproducable in your fork of Myra? Sorry, but this issue tracker is related to the master Myra repo. So, please, provide an MML that can be pasted in the master MyraPad.