//获得类所在的程序集名称(此处我选择当前程序集)
string bllName = System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location); //获得类名(我此处是提前写入Button的Name属性)
string className = (sender as Button).Name; //获得类全名,格式:WpfApplication.ToggleButton
string fullClassName = bllName + "." + className; //根据类名称创建类实例
var bllObject = System.Reflection.Assembly.Load(bllName).CreateInstance(fullClassName);

  

05-11 13:50