There are two problems that I can see.
First, it looks like you're treating Margin1 as a fold margin which it normally isn't by default. Try working with Margin2 instead.
The other issue is one of the idiosyncrasies with Scintilla that we haven't handled very well in ScintillaNET. Folding is actually a property set on each individual lexer. We've broken it out into it's own property but it really is a function of
public bool IsEnabled
return Scintilla.Lexing.GetProperty("fold") == "1";
s = "1";
s = "0";
Your issue pretty much stems from the fact that in the setter, we're setting folding for HTML (i.e. XML) but on the getter that's not the value we're giving back to you. Consequently the IsEnabled property isn't getting serialized at design time (or giving
you an accurate value) and you must set it again at runtime. The order of design time serialization is also critical but that's another topic.
For now you can continue to work around your issue by setting the Folding.IsEnabled property early in your form/control load to reset it, however, I would encourage you to create a work item in our Issue Tracker and offer suggestions on a fix.