如何获取WPF ItemsControl的常规ItemContainer类型

问题描述 投票:6回答:1

我想从现有的ItemContainer对象确定ItemsControl类型。

   var item = control as ItemsControl;
    //HOW to get child container Type?

一个如何通过Blend完成的示例:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS80amRIVC5wbmcifQ==” alt =“在此处输入图像描述”>“ >>

以某种方式混合确定当前TabControl类型的子项是TabItem

如何在代码中做同样的事情?

我想从现有的ItemsControl对象确定ItemContainer类型。 var item = control as ItemsControl; //如何获取子容器类型?混合如何完成的示例:...

wpf silverlight user-controls wpf-controls itemscontrol
1个回答
8
投票

StyleTypedPropertyAttribute派生的大多数类上都有StyleTypedPropertyAttribute。得到一个ItemsControl等于Property的值。该属性的"ItemContainerStyle"属性应为您提供商品类型。

© www.soinside.com 2019 - 2024. All rights reserved.