WPF/XAML Intuitive UserControl -
what steps must done make user control, work in such order:
<local:myusercontrol itemssource="{binding items}"> <local:myusercontrol.items> <local:myusercontrol.item name="{binding name}"/> </local:myusercontrol.items> </local:myusercontrol>
i know itemssource need create dependencyproperty, part inside myusercontrol.
example:
look below example how used it.
this called myusercontrol
<usercontrol> <grid> <itemscontrol itemssource="{binding items}"> <itemscontrol.itemspanel> <itemspaneltemplate> <wrappanel /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <button content="{binding name}" margin="3,3,3,3"/> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </grid> </usercontrol>
mainpage:
<local:myusercontrol />
as can see in scenario, myusercontrol not universal, can used if have itemssource called items, , inside of there property called name.
my intention create flexible myusercontrol.
thanks in advance.
Comments
Post a Comment