Try using the Name property of the class Type:
private void ShowExecuted(DataTemplate s) {
var typeName = s.DataType as Type;
if (typeName == null)
return;
var className = typeName.Name; // className will be EmployerSetupVM or VendorSetupVM
...
}
I'd still say passing the DataTemplate
to the VM just seems strange. I'd just have two commands and switch the command used in the Button.Style
according to the conditions you got.
If you "have" to use a single RelayCommand
or the world might end, I'd tend to use a static enum that you can reference from xaml for CommandParameter
than pass the whole DataTemplate
object.