[reflection] Coop handles icalls in System.Reflection and System.RuntimeTypeHandle...
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / PropertyInspector / CategoryLayoutContainer.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.Windows;
8     using System.Windows.Data;
9     using System.Windows.Controls;
10     using System.Activities.Presentation.PropertyEditing;
11
12     internal class CategoryLayoutContainer : ItemsControl
13     {
14         public CategoryLayoutContainer()
15         {
16         }
17
18         protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
19         {
20             ContentPresenter contentPresenter = element as ContentPresenter;
21             CategoryEditor categoryEditor = item as CategoryEditor;
22             if (contentPresenter != null && categoryEditor != null)
23             {
24                 Binding contentBinding = new Binding("DataContext.Category");
25                 contentBinding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(CategoryLayoutContainer), 1);
26                 contentPresenter.SetBinding(ContentPresenter.ContentProperty, contentBinding);
27                 contentPresenter.ContentTemplate = categoryEditor.EditorTemplate;
28             }
29
30             base.PrepareContainerForItemOverride(element, item);
31         }
32     }
33 }