1

System.Windows.Controls.Control または System.Windows.Controls.StackPanel のいずれかを返す関数が必要です。

理想的には、両方または両方の基本クラスによって実装されたインターフェースであるべきです(私はこの目的でオブジェクトを使用するのは嫌いです)

UIElement などのようなものは、そのうちの 1 つだけに限定されているようです。

何か案は?

4

2 に答える 2

3

FrameworkElementが唯一の賭けのようです。

于 2011-06-24T08:45:14.190 に答える
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
于 2011-06-24T08:52:23.320 に答える