View previous topic :: View next topic |
Author |
Message |
Ger83
Joined: 15 Sep 2009 Posts: 5 Location: Pretoria, South Africa
|
Posted: Tue Mar 29, 2011 12:21 pm Post subject: How to programmatically implement Context Sensitive Columns |
|
|
I am programmatically binding data in my Virtual Tree (similar to the Sample).
How would I programmatically enable the VT to only show columns that are relevant to certain Rows.
Lets say for this example I have Group typed items and Member typed items. For Group I have a column Count and for Member a column Colour. I only want to show the Count column when a Group item is selected and only Colour when a Member is selected.
I have allready set the two columns' ContextSensitive to "true".
I understand that I would have to set up some sort of binding as well, but dont know where or how.
The only binding currently happening is in _GetChildren, as follows
Code: | Group^ l_pGroup = dynamic_cast< Group^ >( l_pEventArgs->Row->Item );
l_pEventArgs->Children = l_pGroup->Children; |
Any pointers in the right direction would be highly appreciated
G |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Mar 29, 2011 11:16 pm Post subject: |
|
|
To implement context sensitive columns programmatically you should should handle the GetColumnInContext event (or override the ColumnInContext method) and set the e.InContext property. This event is called for each column, you should set the value to be true if you want the given column displayed for the current ContextRow. _________________ Infralution Support |
|
Back to top |
|
|
Ger83
Joined: 15 Sep 2009 Posts: 5 Location: Pretoria, South Africa
|
Posted: Wed Mar 30, 2011 4:44 am Post subject: |
|
|
Hi.
Thanks for the reply. My main problem was actually that I did not set up the "Object bindings" in the Virtual Tree Editor. So what I did (which I did not actually know one should do), is create an object binding, add the columns that should be displayed for the binding and then give the Type (which I totally messed up). Initially I gave the type as "Namespace::Namespace::Class", where I should have given it as "Namespace.Namespace.Class". After I did that, and set the columns as "ContextSensitive = true", it worked.
G |
|
Back to top |
|
|
|