fix: add carousel indicator back.

This commit is contained in:
rabbitism 2023-05-09 22:24:51 +08:00
parent b3737bfee6
commit b5a9c8f53e
2 changed files with 4 additions and 3 deletions

View File

@ -141,7 +141,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
ItemsSource="{TemplateBinding ItemsSource,
ItemsSource="{TemplateBinding ItemCount,
Mode=OneWay,
Converter={StaticResource ItemsConverter}}"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ListBox.ItemsPanel>

View File

@ -12,9 +12,9 @@ public class ItemToObjectConverter: IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is ItemCollection list)
if (value is int i)
{
return list.Select(a => new object());
return Enumerable.Repeat(new object(), i).ToList();
}
return new List<object>();
}