コード例 #1
0
ファイル: Visual3D.cs プロジェクト: JianwenSun/cc
        /// <summary>
        ///     Check all the children for a bit.
        /// </summary>
        internal static bool DoAnyChildrenHaveABitSet(Visual3D pe,
                                                      VisualFlags flag)
        {

            int count = pe.InternalVisual2DOr3DChildrenCount;
            for (int i = 0; i < count; i++)
            {
                DependencyObject child = pe.InternalGet2DOr3DVisualChild(i);
                                
                Visual v = null;
                Visual3D v3D = null;
                VisualTreeUtils.AsNonNullVisual(child, out v, out v3D);
                
                if (v != null && v.CheckFlagsAnd(flag))
                {
                    return true;
                }
                else if (v3D != null && v3D.CheckFlagsAnd(flag))
                {
                    return true;
                }
            }

            return false;
        }
コード例 #2
0
        // This is called from the force-inherit property changed events.
        internal static void InvalidateForceInheritPropertyOnChildren(Visual3D v, DependencyProperty property)
        {
            int cChildren = v.InternalVisual2DOr3DChildrenCount;
            for (int iChild = 0; iChild < cChildren; iChild++)
            {
                DependencyObject vChild = v.InternalGet2DOr3DVisualChild(iChild);
                if (vChild != null)
                {
                    UIElement element = vChild as UIElement;
                    UIElement3D element3D = vChild as UIElement3D;

                    if (element3D != null)
                    {
                        if (property == IsVisibleProperty)
                        {
                            // For Read-Only force-inherited properties, use
                            // a private update method.
                            element3D.UpdateIsVisibleCache();
                        }
                        else
                        {
                            // For Read/Write force-inherited properties, use
                            // the standard coersion pattern.
                            element3D.CoerceValue(property);
                        }
                    }
                    else if (element != null)
                    {
                        if (property == IsVisibleProperty)
                        {
                            // For Read-Only force-inherited properties, use
                            // a private update method.
                            element.UpdateIsVisibleCache();
                        }
                        else
                        {
                            // For Read/Write force-inherited properties, use
                            // the standard coersion pattern.
                            element.CoerceValue(property);
                        }
                    }
                    else
                    {
                        // We have to "walk through" non-UIElement visuals.
                        if (vChild is Visual)
                        {
                            UIElement.InvalidateForceInheritPropertyOnChildren((Visual)vChild, property);
                        }
                        else
                        {
                            InvalidateForceInheritPropertyOnChildren((Visual3D)vChild, property);
                        }
                    }
                }
            }
        }