Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ItemsRepeater does not respect control alignment #3040

Closed
grokys opened this issue Sep 28, 2019 · 2 comments
Closed

ItemsRepeater does not respect control alignment #3040

grokys opened this issue Sep 28, 2019 · 2 comments
Labels

Comments

@grokys
Copy link
Member

grokys commented Sep 28, 2019

ItemsRepeater does not currently respect the HorizontalAlignment/VerticalAlignment of child controls.

This seems to work on UWP so there's something up with our port.

@grokys
Copy link
Member Author

grokys commented Oct 2, 2019

This does actually seem to work correctly when the ItemsRepeater is not contained within a ScrollViewer which has horizontal scrolling enabled (as in ControlCatalog). I do however think it could handle this a bit better, need to double check with UWP and raise an issue there if necessary.

@grokys grokys closed this as completed Oct 2, 2019
@lostmsu
Copy link

lostmsu commented Sep 2, 2022

@grokys I recently stumbled upon ItemRepeater not honoring HorizontalAlignment. To my surprise, ListBox does o-O

<StackPanel
            Orientation="Vertical"
            VerticalAlignment="Center" HorizontalAlignment="Center"
            >
  <ItemsRepeater Items="{Binding RecentDirectories, ElementName=Root, Mode=OneWay}"
                 HorizontalAlignment="Center"
                 >
    <ItemsRepeater.ItemTemplate>
      <DataTemplate>
        <Button Content="{Binding Name, Mode=OneWay}"
                Command="{Binding OpenFolderCommand, ElementName=Root, Mode=OneTime}"
                CommandParameter="{Binding FullPath, Mode=OneWay}"
                CornerRadius="0"
                />
      </DataTemplate>
    </ItemsRepeater.ItemTemplate>
  </ItemsRepeater>

  <Button ... />
</StackPanel>

With ItemsRepeater (e.g. above XAML):
image

If I replace ItemsRepeater with ListBox in the above:
image

Avalonia 0.10.18 on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants