问题
I am trying to get Tagbuilder for Telerik ScrollView Component to work. Currently add Items is not working; it is not transmitting the image divs, and showing a blank page. How would I fix this? Enclosed is tagbuilder below. Am I missing variables or attributes ?
Ideal Telerik code is transmitting div data-role page. My code is transmitting li class scroll-view-page, which are not the right items.
My Test Code and HTML:
public class ScrollViewTestTagHelper : ScrollViewTagHelper
{
[HtmlAttributeName("ScrollViewName")]
public string ScrollViewName { get; set; }
[HtmlAttributeName("ScrollViewContentHeight")]
public string ScrollViewContentHeight { get; set; }
public ScrollViewTestTagHelper(IKendoHtmlGenerator generator) : base(generator)
{
}
public override void Process(TagHelperContext context, TagHelperOutput output)
{
this.Name = ScrollViewName;
this.ContentHeight = ScrollViewContentHeight;
ScrollViewItemsTagHelper ItemTest = new ScrollViewItemsTagHelper();
ItemTest.ContentOutputs.Add("<div class='photo photo1'></div>");
ItemTest.ContentOutputs.Add("<div class='photo photo2'></div>");
this.Items = ItemTest;
base.Process(context, output);
}
}
}
CSHTML:
<scroll-view-test ScrollViewName="scrollView"
ScrollViewContentHeight="100%"></scroll-view-test>
<style>
.photo {
display: inline-block;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
width: inherit;
height: inherit;
}
.photo1 {
background-image: url("https://www.woodlandtrust.org.uk/media/100078482/Sycamore01.jpg?cb=-11897985&preset=gallery-tab-main-image");
}
.photo2 {
background-image: url("https://statesymbolsusa.org/sites/statesymbolsusa.org/files/styles/symbol_thumbnail__medium/public/primary-images/Applesfreshpicked.jpg?itok=YmYkBfY7");
}
</style>
Ideal HTML Code from their website: https://demos.telerik.com/aspnet-core/scrollview/index
https://www.telerik.com/forums/scrollview-taghelper-in-telerik-not-seen
来源:https://stackoverflow.com/questions/57069066/net-core-create-tagbuilder-for-kendo-telerik-scrollview