Could someone point me in the right direction on how would I go about creating htmlhelpers that you could call in the view something like the code below.
<% using (Html.BeginSvg())
{%>
<% using (Html.BeginGroup("Group1")) {%>
<%= Html.SvgLine("Line1").Class("blueLine").Style("stroke-width:2px").X1(25).Y1(25).X2(25).Y2(25).Transform().Scale(-2)%>
<%= Html.SvgLine("Line1").Class("blueLine").Style("stroke-width:2px").X1(100).Y1(25).X2(100).Y2(125).Transform().Scale(-2)%>
<%} %>
<%= Html.SvgRect("box").Class("redBox").X(12).Y(10).Width(234).Height(200) %>
<%} %>
Is it possible? is it sane? 🙂 is there something like this already implemented?
Cheers
Si
I don’t know if it’s been done but Fluent Interfaces are awesome…here’s a very basic implementation for you.
And here’s how you use it in your html
You have to call the tostring method as the last call (or another method that finalizes your fluent interface – the one that returns a string representation of your object)