I have using a DelegateCommand and i want to pass the UserControl with Command.
#region OpenViewCommand
private DelegateCommand<UserControl> _openViewCommand;
public ICommand OpenViewCommand
{
get
{
if (_openViewCommand == null)
_openViewCommand = new DelegateCommand<UserControl>(new Action<UserControl>(OpenView));
return _openViewCommand;
}
}
public void OpenView(UserControl ViewName)
{
UserControl ctrl = (UserControl)ViewName;
JIMS.Controls.Message.Show(ViewName.ToString());
}
#endregion
Command in XAML
<Button Name="btnStockGroups" Command="{Binding OpenViewCommand}" CommandParameter="JIMS.View.Stock.StockGroups">stock group</Button>
If you give your UserControl an x:Name (e.g. "MyView"), you should be able to do something like this:
<Button Name="btnStockGroups"
Command="{Binding OpenViewCommand}"
CommandParameter="{Binding ElementName=MyView}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With