View previous topic :: View next topic |
Author |
Message |
Mark Johnson Guest
|
Posted: Wed Mar 09, 2005 12:28 am Post subject: Expansion Icon |
|
|
Anyway to turn off the + next to a node that has no children?
I'm using the RowChildPolicy.LoadOnExpand policy since I have lots of data that I want to only load on demand.
I need to turn off the + for rows that I know have no children when the row is asked for it's cell data.
Thanks,
Mark |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Mar 09, 2005 2:59 am Post subject: |
|
|
Simply set the RowChildPolicy to be RowChildPolicy.Normal for rows that you know never have children. This will mean that VirtualTree will request the children for that row immediately, discover there are none and so not display the expansion symbol.
Typically you know that certain row types never have children and so you can set the ChildPolicy in the RowBindings (using the editor if you are using data binding). If you are using programatic data binding then set the RowChildPolicy in the GetRowData event/method based on the type of the row.Item.
I would usually only use LoadOnExpand for the top level rows and only then if experience showed that performance was going to be an issue - because it forces the user to click on the expand symbol to see if a row has children and so removes some useful information.
Regards
Grant _________________ Infralution Support |
|
Back to top |
|
|
Mark Johnson Guest
|
Posted: Wed Mar 09, 2005 5:47 pm Post subject: |
|
|
Thanks, got it to work. |
|
Back to top |
|
|
Longmountain
Joined: 02 Aug 2006 Posts: 4
|
Posted: Fri Aug 11, 2006 12:07 pm Post subject: |
|
|
Now with 3.0, is it possible to specify each row whether there are child’s present? So that the + won’t be visible for rows which doesn’t have any child’s.
I'm using the RowChildPolicy.LoadOnExpand policy. The object in the row has a property indicating there are child’s present in the database. Perhaps it’s possible to use this property in the VirtualTree_GetRowData event to change row attributes? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Aug 11, 2006 2:31 pm Post subject: |
|
|
The whole point of RowChildPolicy.LoadOnExpand is that Virtual Tree will not check the node to see if it has children. This can improve performance - depending on how long that check takes but means that the + has to be shown until the user clicks it.
If you don't want the + shown when there are no children then use RowChildPolicy.Normal. _________________ Infralution Support |
|
Back to top |
|
|
Longmountain
Joined: 02 Aug 2006 Posts: 4
|
Posted: Fri Aug 11, 2006 2:44 pm Post subject: |
|
|
The node doesn't have to check if it has children because the node already knows. The node doesn't yet contain the children but an indication property "HasChildren" as a bool. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Aug 11, 2006 11:53 pm Post subject: |
|
|
You can handle the GetChildPolicy event (or override the GetChildPolicyForRow method) and set the ChildPolicy to LoadOnExpand only for your nodes that have your HasChildren flag set to true. _________________ Infralution Support |
|
Back to top |
|
|
|