如何从代码创建它?
<CheckBox Command="{Binding Source={StaticResource VMLocator}, Path=TimeTableInformationViewModel.MyCommand }"
CommandParameter="{Binding valueFromInput}" />
我不确定如何从代码后面设置 Command 属性:
public static DataTemplate CreateDataTemplate()
{
var block = new FrameworkElementFactory(typeof(CheckBox));
block.SetBinding(CheckBox.CommandProperty, new Binding(""));
DataTemplate newDataTemplate = new DataTemplate() { VisualTree = block };
}