wpf - Why does ItemContainerGenerator return null? -


itemprop = "text">

I have a listbox, and I have to set its control template in a virtualizing rapprapnel, which is the class that extends the virtualizing panel. Which looks like this:

  style target type = "{x: type list box}" X: key = "photo album style" & gt; & Lt; Setter Property = "Foreground" Value = "White" /> & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: Type list box}" & gt; & Lt; S: VirtualizingVerticalWrapPanel & gt; & Lt; / S: VirtualizingVerticalWrapPanel & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;  

Now, try to use this method of Virtual Virtualization RapPanel below, but I get zero value, no idea what the problem is ??

  Private Wide AliveFestum () {IItemContainerGenerator Generator = this.ItemContainerGenerator; Generator status pos = generator.GeneratorPositionFromIndex (0); UIElement (Generator. StartAut (Status, Generator Direction. Forward)) {UIElement element = generator.GenerateNext ()); Generator.PrepareItemContainer (element); This.AddInternalChild (element); }}   

I think I have a similar problem and it helped:

  var Required Chirendauch = this.Children; IItemContainerGenerator Generator = this.ItemContainerGenerator;  

... For some reason you have to "touch" in the children's archive to get the itemcontent generator to start properly.


Comments