Test.razor 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. @page "/test"
  2. @code{
  3. IList<Item> items = new List<Item> {
  4. new Item {
  5. Source = "/img/test1.png",
  6. Alt ="First Slide",
  7. Caption = "Slide 1",
  8. Header = "Slide 1 Header"
  9. },
  10. new Item {
  11. Source = "/img/test2.png",
  12. Alt ="Second Slide",
  13. Caption = "Slide 2",
  14. Header = "Slide 2 Header"
  15. }
  16. };
  17. class Item
  18. {
  19. public string Source { get; set; }
  20. public string Alt { get; set; }
  21. public string Caption { get; set; }
  22. public string Header { get; set; }
  23. }
  24. }
  25. <BSCarousel NumberOfItems="@items.Count" Interval="1">
  26. <div class="carousel-inner">
  27. @for (int i = 0; i < items.Count; i++)
  28. {
  29. <BSCarouselItem src="@items[i].Source" alt="@items[i].Alt" />
  30. }
  31. </div>
  32. <BSCarouselIndicators NumberOfItems="@items.Count" />
  33. @*<BSCarouselControl CarouselDirection="CarouselDirection.Previous" NumberOfItems="@items.Count"/>
  34. <BSCarouselControl CarouselDirection="CarouselDirection.Next" NumberOfItems="@items.Count"/>*@
  35. </BSCarousel>