Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GetRowBinding with subclass

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
GreyCloud



Joined: 13 Nov 2008
Posts: 19

PostPosted: Mon Mar 29, 2010 11:23 am    Post subject: GetRowBinding with subclass Reply with quote

Hi,

I have a tree which will contain various types of node - all subclasses of the a node type i have used the object binding on - all classes share a common set of fields and so i have a common set of columns to edit these [eg name and quantity].

Code:

// within SimTree_GetCellData
// get the default binding for the given row and use it to populate the cell data           
            RowBinding binding = this.SimTree.GetRowBinding(e.Row);
            binding.GetCellData(e.Row, e.Column, e.CellData);


however GetRowBinding fails to return a row binding for the first subclass i have created.

Is this something that is simply not possible whilst using GetRowBinding?
I thought it might have something to do with the compare methods on my class hierarchy but they are not called when i expand the tree to show the node

to get arround this i suppose i can handle each of the columns manually but i'd be interested to know whats going on Wink
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Mar 29, 2010 10:40 pm    Post subject: Reply with quote

If you have defined an ObjectRowBinding for the parent type then calling GetRowBinding for a row containing a derived item should work. However you do need to ensure that the ObjectRowBinding.TypeName specifies the fully qualified typename of the parent type. The ObjectRowBinding resolves the typename to a type using System.Type.GetType(typeName).

If it is unable to resolve the TypeName to a type then the ObjectRowBinding fallsback to string matching based on the last part of the item typename ie if your base class is "MyNamespace.MyBase" and your derived class is "MyNamespace.MyDerivedBase" then if you specified TypeName = "Base" this would match any class name ending with "Base".

If you want to handle the binding process yourself then you can handle the GetBinding event.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
GreyCloud



Joined: 13 Nov 2008
Posts: 19

PostPosted: Tue Mar 30, 2010 11:51 am    Post subject: Reply with quote

Thanks, that's got it Very Happy - it had fallen victim to some over zealous ReSharper Refactoring i did a few weeks back Wink

I had "Project.Nodes.SimNode" but not "Project.Nodes.SimNode, Project"
what is the ", Project" part do ? is it the assembly?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Mar 30, 2010 9:49 pm    Post subject: Reply with quote

Yes that is the assembly.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group