We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : WPF
|
Category : DataBinding

How can I bind a method and pass a parameter to the method ?

As with support for parameterized constructor, this is most useful for existing classes that are not databinding-friendly and can’t be changed. For your own types, you might as well expose potential datasources as properties. But note that the photos collection exposed a method call "GetFolderName", that returned a string representing the folder containing all the current items. You could expose this method as a datasource as follows.

If the parameters need to be passed to the method, you can use ObjectDataProvider’s "MethodParameters" property ( which works just like it’s ConstructorParameter property).

To Bind this method, simply bind it to the entire ObjectDataProvider.

Specifying the path in this case would apply to the instance returned by the method.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.