HandyControl icon indicating copy to clipboard operation
HandyControl copied to clipboard

Bug title 轮播控件Carousel绑定数据时异常问题

Open L-MAX6 opened this issue 1 year ago • 1 comments

Describe the bug

首先,非常感谢你们的付出,控件很好用,谢谢。在使用中,我发现轮播控件Carousel绑定数据后不会自动更新,需要每次数据更新完毕后调用hcCarousel.OnApplyTemplate()才能更新,但还是有点问题,OnApplyTemplate()后第一张图片显示的宽度少于设定的宽度,要切换到第二张图片后才会恢复正常。如果直接在XAML中写死Image,宽度是正常的,看下图。期待你们的回复

Steps to reproduce the bug

XAML 代码 显示有问题,后面有截图: `<hc:Carousel x:Name="hcCarousel" ItemsSource="{Binding ImageList}" Interval="0:0:5" IsCenter="True" AutoRun="True" Width="380" Height="400" VerticalAlignment="Center"> hc:Carousel.ItemTemplate <DataTemplate> <hc:SimplePanel Width="380"> <Image Source="{Binding ImagePath}" Width="380" MinWidth="380" Stretch="UniformToFill" /> <TextBlock Text="{Binding ImageText}" Style="{StaticResource TextBlockDefault}" FontSize="20" FontWeight="Bold" Foreground="Red"/> </hc:SimplePanel>

    </DataTemplate>
</hc:Carousel.ItemTemplate>

</hc:Carousel>ViewModel代码: View.hcCarousel.PageIndex = 0; View.hcCarousel.OnApplyTemplate();`

Expected behavior

No response

Screenshots

errImage trueImage

第一个图片就是OnApplyTemplate()后第一张图片显示 正常宽度是第二张图片

NuGet package version

None

IDE

Visual Studio 2022

Framework type

No response

Windows version

No response

Additional context

VS 2022 .NET 9.0 HandyControl 3.5.1

L-MAX6 avatar Dec 10 '24 09:12 L-MAX6

微信截图_20241210175737

L-MAX6 avatar Dec 10 '24 09:12 L-MAX6