2011-06-24 8 views
1

System.Windows.Controls.ControlまたはSystem.Windows.Controls.StackPanelのいずれかを返す関数が必要です。StackPanelとコントロールの共通基本クラスまたはインターフェイス

理想的には、それは

(私は、この目的のためにオブジェクトを使用して嫌い)の両方またはそれらの両方の基底クラスが実装するインターフェースのthatsであるべきのUIElementなどの同類は「日のいずれかに排他的であるように見えます。

アイデア?

答えて

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 
+1

おかげで動作します。私はフレームワーク要素を最も近い祖先として選び、別の開発者が意図しない目的でこれを使用する可能性が最も低いと考えています。 – cethie

関連する問題