简体   繁体   English

为什么Silverlight的ItemsControl不具有ItemContainerStyle属性?

[英]Why doesn't Silverlight's ItemsControl have an ItemContainerStyle property?

The title pretty much says it all. 标题基本概括了所有内容。 I can roll my own, but given WPF has it, it's conspicuous by its absence. 我可以自己动手,但是鉴于WPF拥有它,因此它的缺席是显而易见的。

I think exactly answered may only Silverlight developers, but they usually do not like to answer such questions. 我认为确切的答案可能只有Silverlight开发人员,但他们通常不喜欢回答此类问题。 Silverlight is much stripped down version of WPF, it is done because MSDN : Silverlight是WPF的简化版本,之所以如此是因为MSDN

To keep Silverlight small and lightweight, some WPF and .NET Framework features are not available in Silverlight . 为了使Silverlight保持小巧轻便, Silverlight中不提供某些WPF和.NET Framework功能。

Why is removed ItemContainerStyle ? 为什么要删除ItemContainerStyle Probably thought he was there in ListBox, so as an alternative you can use ListBox.ItemContainerStyle . 可能以为他在ListBox中,所以可以使用ListBox.ItemContainerStyle作为替代。

Although the developers could not just remove the ItemContainerStyle property from ItemsControl class, because this property is not in ListBox WPF, he inherits is from Selector class and Selector from ItemsControl like this: 尽管开发人员不能仅从ItemsControl类中删除ItemContainerStyle属性,但由于此属性不在ListBox WPF中,所以他继承自Selector类,并从ItemsControl继承Selector,如下所示:

[Localizability(LocalizationCategory.ListBox)]
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(ListBoxItem))]
public class ListBox : Selector
{
   ...
}

This once again proves that it is a deliberate decision taken at the design stage of Silverlight. 这再次证明这是在Silverlight设计阶段做出的故意决定。

In fact, many things in Silverlight and in WPF are implemented differently. 实际上,Silverlight和WPF中的许多事情都是以不同的方式实现的。 Therefore, I advise you to see this links, but again, this is only a small (common) part of the difference: 因此,我建议您看一下此链接,但同样,这只是区别的一小部分(常见):

Contrasting Silverlight and WPF

WPF Compatibility

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的ListView的ItemContainerStyle没有正确更新? - Why doesn't my ListView's ItemContainerStyle update properly? 是否在ItemsControl的ItemContainerStyle中将Canvas属性设置为“可混合”? - Is setting Canvas properties in an ItemsControl's ItemContainerStyle 'Blendable'? ItemsControl、ItemContainerStyle 和 ItemTemplate - ItemsControl, ItemContainerStyle and ItemTemplate 为什么ItemsControl不能全部显示 - Why the ItemsControl doesn't show all 基于画布的ItemsControl的ItemContainerStyle - ItemContainerStyle for Canvas-based ItemsControl 为ItemsControl.ItemContainerStyle指定ControlTemplate - Specify ControlTemplate for ItemsControl.ItemContainerStyle WPF XAML中不会触发ListBox项的ItemsControl中的按钮 - Button in ListBox item's ItemsControl doesn't fire in WPF XAML 项目源Collection上的WPF ItemsControl.ItemContainerStyle setter属性无法引用该属性 - WPF ItemsControl.ItemContainerStyle setter properties on an items source Collection can't reference the properties Silverlight 3中ItemContainerStyle中的数据绑定问题 - Problems with data binding in ItemContainerStyle in Silverlight 3 如何将ItemsControl的ItemsSource绑定到IEnumerable的T类内部的属性 <T> ? - How to bind ItemsControl's ItemsSource to a Property that is inside of class T from IEnumerable<T>?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM