Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Need access to ItemContainerGenerator.Refresh or ItemsControl.OnItemContainerStyleChanged
2 replies. Latest Post by n8allan on November 10, 2009.
(0)
n8allan
Member
20 points
18 Posts
11-05-2009 1:18 AM |
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>
-NateDatabase Consulting Group
Min-Hong...
Contributor
3619 points
412 Posts
11-10-2009 1:17 AM |
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
11-10-2009 6:26 PM |
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 AllanDatabase Consulting Group