using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;  void Child_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.Source is TextBlock)
            {
                string str = ((TextBlock)e.Source).Text;                if (menucommand != null)
                {
                    menucommand(str, null);
                }            }
            else if (e.Source is Rectangle)
            {
                string str = string.Empty;
                foreach (FrameworkElement em in ((Grid)((Rectangle)e.Source).Parent).Children)
                {
                    if (em is TextBlock)
                    {
                        str = ((TextBlock)em).Text;
                    }                }
                if (menucommand != null)
                {
                    menucommand(str, null);
                }
            }            PopUp.IsOpen = false;
        }///////////////////////////////////////////////////////////////////
出错:
"System.Windows.Input.mouseButtonEventArgs"不包含"Source"的定义
应该怎么处理?

解决方案 »

  1.   

    if (e.Source is TextBlock) 中的e.SAource出错"System.Windows.Input.mouseButtonEventArgs"不包含"Source"的定义 
      

  2.   

    if (e.Source is TextBlock) 
    if (e.Source is Rectangle) 中的 “e.Source”出错
    "System.Windows.Input.mouseButtonEventArgs"不包含"Source"的定义 不能进行生成解决方案
      

  3.   

    根据报错的提示:
    MouseButtonEventArgs这个类里面 没有Source这个属性