2011-03-05 21 views
0

私はWPFでアプリケーションを作成しています。私はIScrollInfoインターフェイスを実装して、キャンバスの可視領域を取得しています。私は、ビューポートを取得する方法MeasureOverride(Size availableSize)をオーバーライドしていますが、私は理解することはできませんよエラーが表示されます。エラー:エラー名前 'Children'は現在のコンテキストに存在しません

protected override Size MeasureOverride(Size availableSize) 
     { 

      foreach (UIElement child in Children) 
      { 

       child.Measure(availableSize); 
       resultSize.Width = Math.Max(resultSize.Width, 
       child.DesiredSize.Width); 
       resultSize.Height = Math.Max(resultSize.Height, 
         child.DesiredSize.Height); 
         extent.Width += child.DesiredSize.Width; 
      } 

      resultSize.Width = double.IsPositiveInfinity(availableSize.Width)? resultSize.Width : availableSize.Width; 
      resultSize.Height = double.IsPositiveInfinity(availableSize.Height)? resultSize.Height : availableSize.Height; 
      extent.Height = resultSize.Height; 

      if ((_viewport != resultSize || _extent != extent) && ScrollOwner != null) 

      { 
         _viewport = resultSize; 
         _extent = extent; 

         ScrollOwner.InvalidateScrollInfo(); 
      } 

      return resultSize; 
     } 

ことで子どもたちは何...

答えて

0

をあなたはキャンバスを使用すると、子供たちがします:MSDN Canvasから

:直接キャンバスの内容です

Children Gets a UIElementCollection of child elements of this Panel. (Inherited from Panel.)

すべての "サブ項目"。 あなたの場合、実際のスクロール状態に合わせてすべてを移動する必要があります。

子供がいない場合、キャンバスを伸ばすことはできません。

関連する問題