Skip to main content

Microsoft Silverlight

Answered Question Need access to ItemContainerGenerator.Refresh or ItemsControl.OnItemContainerStyleChangedRSS Feed

(0)

n8allan
n8allan

Member

Member

20 points

18 Posts

Need access to ItemContainerGenerator.Refresh or ItemsControl.OnItemContainerStyleChanged

This is a request for one or members to be exposed.  In order to implement a custom ItemsControl, I need to be able to call ItemContainerGenerator.Refresh(), or need to be able to call down to ItemsControl.OnItemContainerStyleChanged to do the job like TextBox does.  Both of these things are internal.  Without access to these I must hack to properly set all child container item's styles when an ItemContainerStyle change occurs, which is what I'll have to do for now. 

It would also be nice if we could descend from Selector (the constructor is internal).

<rant>I can understand the desire to minimize the security "surface area", but so much stuff is internal in Silverlight that control development can be a real pain.  It's also pretty ridiculous how Silverlight controls have so many hard-coded inter-dependencies; these are unnecessary departures from autonomous class design IMO.</rant>

-Nate
Database Consulting Group

Min-Hong Tang - MSFT
Min-Hong...

Contributor

Contributor

3619 points

412 Posts

Answered Question

Re: Need access to ItemContainerGenerator.Refresh or ItemsControl.OnItemContainerStyleChanged

Hi,

   I am afraid, this is by design purpose. And I consulted the develop group ,it seems there will be no immediate changes regarding this aspect in recent days.  Sorry for the inconvenience it brought.

  May i ask the scenerio you are dealing with , maybe we can help you to figure out a workaround avoiding using internal members.

Best Regards

    

Min-Hong Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

n8allan
n8allan

Member

Member

20 points

18 Posts

Answered Question

Re: Need access to ItemContainerGenerator.Refresh or ItemsControl.OnItemContainerStyleChanged

Hi Min-Hong,

Thank you for looking into this.  I've got a custom control descended from ItemsControl, and I'm trying to mimic the ItemContainerStyle pattern used by ListBox and others.  The issue raised is handling a change to an ItemContainerStyle property.  In the ListBox case, this property change is handled by calling the above mentioned refresh, which must re-run the PrepareContainerForItemOverride step for each item.  I worked around this by iterating over the items, re-applying the style to each.  So I've already got a work-around, but thanks for the offer.

Best,

--
Nathan Allan
Database Consulting Group

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities