StackPanel和Control的公共基类或接口

时间:2011-06-24 08:29:50

标签: wpf silverlight controls stackpanel base-class

我需要一个函数来返回可以是System.Windows.Controls.Control或System.Windows.Controls.StackPanel的东西。

理想情况下,它应该是由两者或两者的基类实现的接口(我讨厌为此目的使用对象)

UIElement等之类的东西似乎只属于'em'之一。

有什么想法吗?

2 个答案:

答案 0 :(得分:3)

FrameworkElement看起来是你唯一的赌注。

答案 1 :(得分:0)

FrameworkElement是两者最接近的祖先,但是上面的任何东西都很好(包括UIElement):

System.Object 
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Panel
              System.Windows.Controls.StackPanel

System.Object 
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
相关问题