Skip to content

Conversation

@wangx036
Copy link

修改内容:

  1. 轮播图在特性情形下渲染出错
  2. 顺便增加事件 PageIndexChanged

渲染出错图

没有PageButton,并且翻页点击无效。
image

View

public MainWindow() { InitializeComponent(); DataContext = new MainWindowVm(); }

InitializeComponent();DataContext = new MainWindowVm();,会导致Carousel.Items没有Add数据。

ViewModel

public class MainWindowVm { public List<string> ImageList { get; } = new List<string>() { "/HandyControlDemo;component/Resources/Img/1.jpg", "/HandyControlDemo;component/Resources/Img/2.jpg", "/HandyControlDemo;component/Resources/Img/3.jpg", }; }

XAML

<hc:Carousel Height="330" MaxWidth="600" Margin="32" VerticalAlignment="Center" AutoRun="True" Background="BurlyWood" IsCenter="True" ItemsSource="{Binding ImageList}"> <hc:Carousel.ItemTemplate> <DataTemplate> <Image Width="600" Source="{Binding}" Stretch="UniformToFill" /> </DataTemplate> </hc:Carousel.ItemTemplate> </hc:Carousel>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants