Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8820625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:39:16+00:00 2026-06-14T05:39:16+00:00

I am Performing a Tutorial I found in Expression Blend 4 for connecting to

  • 0

I am Performing a Tutorial I found in Expression Blend 4 for connecting to a SQL Server with WPF. After the final steps in VS12 when I do a build I get the following error.

Error   1   The type or namespace name 'DelegateCommand' could not be found (are you missing a using directive or an assembly reference?)
Error   2   The type or namespace name 'DelegateCommand' could not be found (are you missing a using directive or an assembly reference?)

When I do a Clean I do not get these errors.
My Target is .net 4.5 I also tried 4.0

My code That is erroring looks Like this. I bolded the two erroring lines. this is a file called Class1.cs

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;


namespace AWADataSource
{
public class ProductPhotosCollection
{
    **private DelegateCommand getDataCommand;
    public DelegateCommand GetDataCommand { get { return getDataCommand; } }**
    public ProductPhotosCollection()
    {
        getDataCommand = new DelegateCommand(delegate() { GetData(); });
    }


    public ObservableCollection<ProductPhoto> ProductPhotos
    { get { return this.productPhotos; } }
    private ObservableCollection<ProductPhoto> productPhotos =
        new ObservableCollection<ProductPhoto>();
    private void GetData()
    {
        ProductPhotosTableAdapters.ProductPhotoTableAdapter da =
            new ProductPhotosTableAdapters.ProductPhotoTableAdapter();
        ProductPhotos.ProductPhotoDataTable dt = da.GetData();
        productPhotos.Clear();
        foreach (ProductPhotos.ProductPhotoRow row in dt)
        {
            productPhotos.Add(new ProductPhoto(
                row.ProductPhotoID,
                row.ThumbNailPhoto,
                row.LargePhoto,
                row.ModifiedDate));
        }
    }
}
public class ProductPhoto
{

    // Public Accessors to the private properties.
    public int ID { get { return id; } }
    public ImageSource ThumbNailPhoto { get { return thumbNailPhoto; } }
    public ImageSource LargePhoto { get { return largePhoto; } }
    public DateTime ModifiedDate { get { return modifiedDate; } }

    // Constructor.
    public ProductPhoto(int id, byte[] thumbNailPhoto, byte[] largePhoto,
        DateTime modifiedDate)
    {
        this.id = id;
        this.thumbNailPhoto = ByteArrayToImageSource(thumbNailPhoto);
        this.largePhoto = ByteArrayToImageSource(largePhoto);
        this.modifiedDate = modifiedDate;
    }

    // Private properties.
    private int id;
    private ImageSource thumbNailPhoto;
    private ImageSource largePhoto;
    private DateTime modifiedDate;

    // Supporting method.
    private ImageSource ByteArrayToImageSource(byte[] data)
    {
        BitmapImage image = null;
        if (null != data)
        {
            image = new BitmapImage();
            image.BeginInit();
            image.StreamSource = new System.IO.MemoryStream(data);
            image.EndInit();
        }
        return image;
        }
    }
}

and my other file is called DelegateCommand.cs which was pretty much a copy and paist.

namespace AWDataSource
{
using System;
using System.Windows.Input;

///
/// DelegateCommand is a simplified version of ICommand in WPF. You can wrap one of these around any method,
/// and thus bind any command on any WPF object to your method.
///
/// DelegateCommand also supports an IsEnabled property that you can use to turn the command on and off.
///
public sealed class DelegateCommand : ICommand
{
    // Remember the method so that it can be called at the right time.
    private SimpleEventHandler handler;

    // Maintain the enabled state.
    private bool isEnabled = true;

    // Type signature of the method that DelegateCommand works with - returns void, no arguments.
    public delegate void SimpleEventHandler();

    // Simple constructor: Pass in the method that needs to be called when the command executes.
    public DelegateCommand(SimpleEventHandler handler)
    {
        this.handler = handler;
    }

    #region ICommand implementation

    // Executing the command is as simple as calling the method.
    void ICommand.Execute(object arg)
    {
        this.handler();
    }

    // Saying whether the command can be executed.
    bool ICommand.CanExecute(object arg)
    {
        return this.IsEnabled;
    }

    // This is the event that the command architecture of WPF listens to so it knows when to update
    // the UI on command enable/disable.
    public event EventHandler CanExecuteChanged;
    #endregion

    // Public visibility of the isEnabled flag - note that when it is set, the event must be raised
    // so that WPF knows to update any UI that uses this command.
    public bool IsEnabled
    {
        get { return this.isEnabled; }
        set
        {
            this.isEnabled = value;
            this.OnCanExecuteChanged();
        }
    }

    // Simple event propagation that makes sure that someone is listening to the event before raising it.
    private void OnCanExecuteChanged()
    {
        if (this.CanExecuteChanged != null)
        {
            this.CanExecuteChanged(this, EventArgs.Empty);
        }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:39:17+00:00Added an answer on June 14, 2026 at 5:39 am

    ProductPhotosCollection is in namespace AWADataSource while DelegateCommand is in AWDataSource.

    Probably a typo, but you either need to put them in the same namespace, or use a using to import the AWDataSource namespace into ProductPhotosCollection (or in your case “Class1.cs”)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a great tutorial on performing a faceted search. http://www.devatwork.nl/articles/lucenenet/faceted-search-and-drill-down-lucenenet/ This article does
I used this tutorial: http://www.helloandroid.com/tutorials/connecting-mysql-database This is performing awesome. But I got this name
After performing a Menubar> Project> Clean... I get the following error in the errorlog:
When performing an insert lets say from C# into a SQL Server table (using
performing a GET in order to send data to an API before a user
After performing processing I want to calculate the percentage of white pixels between this
When performing some custom painting on a button's Graphics2D object, I get the following
After performing some Google-fu and searching Stack Overflow I've been unable to find a
After performing some operations I am getting a set of records. Example: a b
When performing a phing process to certain servers, the phing task exits after performing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.