Sunday 15 August 2010

c# - How to edit spacing of TreeView nodes -



c# - How to edit spacing of TreeView nodes -

in programme have treeview view element displays nodes strings. add together more space between each node (basically create not condensed). there way through xaml? have looked through of properties in treeview control , have not had luck finding corresponding property. if cannot xaml, how go in c#?

this treeview style implementation:

<style targettype="treeviewitem" > <setter property="isexpanded" value="{binding isexpanded}" /> <style.triggers> <datatrigger binding="{binding hascommands}" value="false"> <setter property="contextmenu" value="{staticresource treeviewemptymenu}" /> </datatrigger> <datatrigger binding="{binding hascommands}" value="true"> <setter property="contextmenu" value="{staticresource treeviewitemcontextmenu}"/> </datatrigger> </style.triggers> </style>

update: right click options using @chris w.'s answer

so if go take @ default template see in there contentpresenter , itemspresenter either go , set hard value margin on margin="0,5" or whatever space need. or bind template come in value inline @ instance.

you can quick right-click on treeview in document outline or on design editor , take edit template->edit current or edit copy, or should able nail item template choosing edit additional templates->edit item, if edit current, you'll edit base of operations default template, if take create re-create assign style template explicitly instance. xaml should required here, no code otherwise, , it's easy peazy.

hope helps, cheers.

c# wpf xaml treeview

No comments:

Post a Comment