The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help

Re: Working on a Free Tree View Control

  •  02-17-2008, 6:08 PM

    Re: Working on a Free Tree View Control

    Hi,

    Good to hear you're doing something for the community! 8)

    Just some hints - the recursive bit is just something that's going on in your code - but the onscreen presentation/display is essentially a flat list (ArrayListDataSet) - as trying to do a Heirachical set of repeaters/lists might be pretty confusing to manage.

    The '+' button should essentially go and fetch the required child items - and then insert them into this list (and if you're using it inside a repeater - then it should be immediately reflected onscreen).

    The '-' button should then either remove these child items from this arraylistdataset (or alternatively you can just set some 'isvisible' style property to false on each child item  - although this maybe harder to manage).

    You can also use a psuedo generic dictionary in the .NET layer (which has a collection of classes which have properties like Key, Description, ParentNodeKey, Level) - and then keep looking up this dictionary when the +/- buttons are being pressed. (and then use this to populate the ArrayListDataSet accordingly - creating a 'cache' style list - which gets built incramentally as nodes are added).  I recommend this approach to keep things simple.

    The indentation bit could be derived from the 'Level' property (which is a value stating how many levels deep this item is in the heirachy) - which could then be exposed as an Inset (which is attached to the Margin property of the item - allowing you to increase the Left Margin based on how many levels deep it is).

    Niall

     

View Complete Thread
Powered by Community Server, by Telligent Systems