[corlib] Avoid unnecessary ephemeron array resizes
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / PropertyInspector / StandardCategoryLayout.cs
1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector
6 {
7     using System;
8     using System.Diagnostics;
9     using System.Windows;
10     using System.Windows.Controls;
11     using System.Windows.Data;
12     using System.Activities.Presentation.PropertyEditing;
13
14     internal class StandardCategoryLayout : ItemsControl
15     {
16         public StandardCategoryLayout()
17         {
18         }
19
20         // This override is present to allow us to skip the automatically inserted ContentPresenter that ItemsControl
21         // generates by default.  PrepareContainerForItemOverride sets up the DataContext and PropertyBinding as though
22         // it were contained within a ContentPresenter and had a Template that was <PropertyContainer Property="{Binding}" />.
23         protected override DependencyObject GetContainerForItemOverride()
24         {
25             return new PropertyContainer();
26         }
27
28         protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
29         {
30             PropertyContainer propertyContainer = element as PropertyContainer;
31             if (propertyContainer != null)
32             {
33                 propertyContainer.DataContext = item;
34                 propertyContainer.SetBinding(PropertyContainer.PropertyEntryProperty, new Binding());
35             }
36
37             base.PrepareContainerForItemOverride(element, item);
38         }
39     }
40 }