开发者

When would the ItemContainerGenerator.Status enumeration return GeneratorStatus.Error?

When would the ItemContainerGenerator.Status enumeration return GeneratorStatus.Error in WPF? Has anyone encountered such a situat开发者_Go百科ion? Just wondering, as I mainly work in Silverlight and the GeneratorStatus doesn't exist there.


the ItemContainerGenerator (if used for example in a ListBox) will create a ListBoxItem for each data item the ListBox is bound to.

The standard ItemContainerGenerator in PresentationFramework has an private class called 'Generator'. When this class is instantiated by the ItemContainerGenerator it sets the ItemContainerGenerator class's Status as GeneratorStatus.GeneratingContainers, then when the ItemContainerGenerator calls Dispose on the Generator instance, the Generator class sets the ItemContainerGenerator status to GeneratorStatus.ContainersGenerated.

GeneratorStatus.Error is never used in the standard implmentation, but if your rolling your own ItemsControl, you can roll your own ItemContainerGenerator and maybe use the error status in your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜