Binding variables as command parameter through binding expression?

If you mean binding to a 'local variables', then its clearly not possible. You are setting up DataContext to some object, and then you can only bind to its properties or dependencyproperties, not local variables of some methods, which doesn't sound logical.

So what can be done for this – Ravi Sep 13 at 5:02 you can bind command to a property of a class, and then you can set that property value to your desired local variable, and then execute the command. – Valentin Kuzub Sep 13 at 5:04 thanks a lot I will try your sugestion – Ravi Sep 13 at 5:48.

You need to be more specific. Can you post some code? You can do something like: ICommand command = new ActionCommand(parameter => { this.

CallFunction(parameter); }); Parameter is a type of object so you can pass any single object and then unbox it. Also ActionCommand requires Blend or at least the Microsoft.Expression. Interactions assembly.

UPDATED Ok in this case you are probaly best to define the ICommand on the view model and bind to it in XAML. On the view model add an implementation like this: public class AViewModel { private ICommand _ACommand; public ICommand ACommand { get { if (this. _ACommand == null) { this.

_ACommand = new ActionCommand(parameter => { // do stuff. }); } return(this. _ACommand); } } } In XAML you need to bind to the data source which you have probaly already done.

Hope this helps.

I want to send property values in view to view model on button click through command parameter. In properties I set local variables so instead asking property values I asked for passing local variables. – Ravi Sep 13 at 4:58 @Ravi If the update doesn't work for you can you post some of your XAML and View Model class.

– Bernie White Sep 13 at 11:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions