Here is how to do so.
<datatemplate x:key="CommandsTemplate" xmlns:x="#unknown">
<itemscontrol itemssource="{Binding Path=Commands}">
<itemscontrol.itemtemplate>
<datatemplate>
<textblock margin="2,6">
<button command="{Binding Path=Command}">
<textblock text="{Binding Path=DisplayName}" />
</button>
</textblock>
</datatemplate>
</itemscontrol.itemtemplate>
</itemscontrol>
</datatemplate>
public class CommandViewModel : ViewModelBase
{
public CommandViewModel(string displayName, ICommand command)
{
if (command == null)
throw new ArgumentNullException("command");
base.DisplayName = displayName;
this.Command = command;
}
public ICommand Command { get; private set; }
}
For further read
MVVM pattern[
^] from MSDN