Assuming a code like below,
public class SomeViewModel{
ICommand ReloadCommand{get...}
ICommand SaveCommand{get..}
}
//SomeView.xaml
<SomeCustomControl Reload="ReloadCommand" Save="SaveCommand" /> //NOT SURE HOW??
//SomeCustomContro.xaml
<SomeCustomControl x:Name="someCustomControl">
<Button Command={Binding ElementName=someCustomControl, Path=Reload />
<Button Command={Binding ElementName=someCustomControl, Path=Save />
</SomeCustomControl>
//SomeCustomControl.xaml.cs
..... //NOT SURE HOW TO ALLOW BINDING TO A ICOMMAND ??
In my SomeCustomControl, I need to support "binding of ICommand in xaml". I understand DependencyProperties could be bind like this, but in this case I need to bind ICommand.
Can somebody please suggest what is the best way to do this? Any suggested material or link would be of use because I am missing a direction.
EDIT 1) I can use the DataContext SomeView in SomeCustomControl. There is more logic and separation between the two which I can not dissolve. I 'must' maintain a reference of Reload/Save ICommands somewhere in my SomeCustomControl.
Thanks a lot.