本帖最后由 suliang1984 于 2011-05-18 09:44:54 编辑

解决方案 »

  1.   

    DependencyProperty 一般来说不需要定义 如果属性要在 XAML 中用到时定义这个才有意义参考 DependencyProperty 类 的备注一般情况 建议使用 INotifyPropertyChanged 接口 进行定义
      

  2.   

    是不是可以这样理解:如果程序集中要大量引用继承自同一基类的实例时,为了节省内存开销,在基类中使用DependencyProperty?
      

  3.   

    哟 上面的链接给错了 [http://msdn.microsoft.com/zh-cn/library/system.windows.dependencyproperty.aspx]DependencyProperty 类[/url]看看其中对 DependencyProperty 声明部分
    [TypeConverterAttribute("System.Windows.Markup.DependencyPropertyConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
    public sealed class DependencyProperty
    再看看微软对 System.Windows.Markup 命名空间 的描述提供用于支持 XAML 的类型。 其中一些类型位于 WPF 程序集中,由涉及 XAML 的 WPF 方案专用。
    此命名空间中的其他类型通常为 .NET Framework XAML 服务提供支持,不需要引用 WPF 程序集。先这么理解吧,当需要开发 XAML 用户控件时 DependencyProperty 才有用
      

  4.   

    var x=(cls_ProductOutputCounter)o;这样就可以使用x来访问Counter1和Counter2了!
      

  5.   

    另外当然,你也可以直接使用  (int)o.GetValue(Counter1Property)、(int)o.GetValue(Counter2Property) 这样的代码,只不过写起来不够优雅。