internal static void StyleChanged(IInvalidating client, string styleProp) { StyleManager styleManager = StyleManager.Instance; /** * 1. Check to see if this is one of the style properties * that is known to affect layout. * */ if (null == styleProp || // null refreshes the object styleProp == "styleName" || // mapper changed styleManager.IsSizeInvalidatingStyle(styleProp)) // component size depends on this style { // This style property change may affect the layout of this // object. Signal the LayoutManager to re-measure the object. client.InvalidateSize(); } /** * 2. This is very important: * It invalidates the component display list upon each style change * UpdateDisplayList will be run in the next frame * This means that we can read all the available styles and manipulate children (for instance in skins, see the PanelSkin) * */ client.InvalidateDisplayList(); /** * 3. Check if we should invalidate parent * */ IInvalidating parent = null; if (client is IVisualElement) { parent = ((IVisualElement)client).Parent as IInvalidating; } if (null != parent) { if (styleProp == "styleName" || styleManager.IsParentSizeInvalidatingStyle(styleProp)) { parent.InvalidateSize(); } if (styleProp == "styleName" || styleManager.IsParentDisplayListInvalidatingStyle(styleProp)) { parent.InvalidateDisplayList(); } } }