Expression Blend doesn't recognize command objects declared in code behind file
- by Brian Ensink
I have a WPF UserControl. The code behind file declares some RoutedUICommand objects which are referenced in the XAML. The application builds and runs just fine. However Expression Blend 3 cannot load the XAML in the designer and gives errors like this one:
The member "ResetCameraCommand" is not
recognized or accessible.
The class and the member are both public. Building and rebuilding the project in Blend and restarting Blend hasn't helped. Any ideas what the problem is?
Here are fragments of my XAML ...
<UserControl x:Class="CAP.Visual.CameraAndLightingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CAP.Visual;assembly=VisualApp"
Height="100" Width="700">
<UserControl.CommandBindings>
<CommandBinding Command="local:CameraAndLightingControl.ResetCameraCommand" Executed="ResetCamera_Executed" CanExecute="ResetCamera_CanExecute"/>
</UserControl.CommandBindings>
....
... and the code behind C#
namespace CAP.Visual
{
public partial class CameraAndLightingControl : UserControl
{
public readonly static RoutedUICommand ResetCameraCommand;
static CameraAndLightingControl()
{
ResetCameraCommand = new RoutedUICommand("Reset Camera", "ResetCamera", typeof(CameraAndLightingControl));
}