I can reproduce it with following error in designer (VS2010 SP1 target framework .NET4.0)
System.Windows.Markup.XamlParseException:
Failed to create a 'CanExecute' from the text 'OnCanExecuteNew'
System.ArgumentException:
Error binding to target method.
But I can build the application and it works on my local machine.
I think the designer works here different as the WPF runtime.
When the template is applied in design time and the event handlers of the CommandBinding get resolved, the resulting visual tree of the template is still not a part of the visual tree of the window. That's why the handlers can not be resolved.
As a workaround I would consider following options.
1) Put CommandBindings in window
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.New"
CanExecute="OnCanExecuteNew"
Executed="OnExecuteNew"/>
</Window.CommandBindings>
2) Wrap the content of the data template in UserControl and put the event handlers in it's codebehind.
UserControl.xaml
<UserControl x:Class="WpfApplication1.UserControl1">
<DockPanel>
<DockPanel.CommandBindings>
<CommandBinding Command="ApplicationCommands.New"
CanExecute="OnCanExecuteNew"
Executed="OnExecuteNew"/>
</DockPanel.CommandBindings>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
<Button Command="ApplicationCommands.New" Content="New"/>
</ToolBar>
</ToolBarTray>
<ContentPresenter Content="{Binding SomeProperty}" />
</DockPanel>
</UserControl>
Window.xaml
<DataTemplate DataType="{x:Type local:MyType}">
<local:UserControl1/>
</DataTemplate>
3) Don't use CommandBindings at all and put your command object(s) in view model (MVVM).
<Button Command="{Binding NewCommand}" Content="New"/>
As a general rule I recommend to avoid tight coupling of data template and code behind. Data template should be something you take and put in resource dictionary.