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 

Bind to an (extension) Method?

 
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: Thu Jul 15, 2010 7:52 pm    Post subject: Bind to an (extension) Method? Reply with quote

Hi,

out of interest, why must i bind to a property in the designer and not a method? (seeing as in binding to a property i am just binding to the get method of the property?)

i ask since i tried to use an extension method for binding to an XElement.. [C# 4.0 still doesnt support extension properties - eg http://blogs.msdn.com/b/ericlippert/archive/2009/10/05/why-no-extension-properties.aspx]

Code:

public static List<XElement> ChildNodes(this XElement element) {
    return element.Elements().ToList();
}


clearly there are many work arounds to this problem but i was just wondering Wink

David
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Jul 15, 2010 10:56 pm    Post subject: Reply with quote

VirtualTree uses reflection to bind to properties. Properties and methods are treated differently by reflection. While it would be technically possible to bind to a (parameterless) method via reflection it would complicate the binding code to deal with the two different mechanisms. Since extension methods are implemented quite differently to standard methods, binding to a standard method via reflection would probably not help here.

The workaround is to use programmatic binding for this cell. You can still use object binding for other rows/cells. See the help section "Mixing Programmatic Binding and Design Time Binding".
_________________
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