xaml - Silverlight: Make all descendants of an element have a margin? -
is there way in silverlight 4 dictate elements within stackpanel must have margin, instead of specifying margin="10,0" on each one?
i'm afraid it's not possible declaratively in xaml stackpanel directly. it's conceptual philosophy in silverlight/wpf panel should not modify properties of children. implement own panel anyway, or use itemscontrol that:
<itemscontrol> <itemscontrol.itemtemplate> <datatemplate> <contentpresenter margin="10,0" content="{binding content}" /> </datatemplate> </itemscontrol.itemtemplate> [...] </itemscontrol> an itemscontrol uses stackpanel default, can use itemspanel property define panel itemspaneltemplate if wish so.
Comments
Post a Comment