I just tried the new Atlas- toolkit and it is really amazing. but one other amazing fact (beside the controls) is the intelli-sense of the extender- controls.
there is nothing included in the project (for example .xsd- files like in many other solutions) and the thing just works.
can someone please tell me how to do that in my own custom controls?
ollifant
Yeah, I would like to know how to do this as well =)
Thanks. :)
Intellisense just uses reflection, so if your markup matches your object hierarchy, you'll get this for free. If you add some magic attributes
For example:
[ParseChildren(ChildrenAsProperties =true, DefaultProperty ="SubObjects")][PersistChildren(false)]public class MyControl : Control {public bool Visible {get;set;} [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [PersistenceMode(PersistanceMode.InnerDefaultProperty)]public SubObjectCollection SubObjects {get;};}public SubObjectCollection : List {}public class SubObject {public bool Enabled {get;set};public bool Name {get;set;}}
Should give you Intellisense on:
<cc1:MyControl runat="server"><cc1:SubObject Enabled="False" Name="MyName"/></cc1:MyControl>
Thanks Shawn
This is more or less the example from the MSDN (with some typos ;), but still, it doesnt work with the intellisense, nore does it give any clue how to have more than one property that is recognised...
It has removed the stupid warnings from the IDE though; yay :D
Hi GSpies,
When you say more than one property, are you talking about more than one nested element inside the control? If that's what you're getting at then you can use[PersistenceMode(PersistenceMode.InnerProperty)] on several different properties so they all appear.
Thanks,
Ted
No comments:
Post a Comment