コード例 #1
0
 private void OnIconForegroundChanged()
 {
     if (_iconPresenter != null)
     {
         if (IconForeground != null)
         {
             var bindingProperty = BindingOperations.GetBinding(Source, IconHelper.ForegroundProperty)?.Path?.PathParameters?.FirstOrDefault() as DependencyProperty;
             if (bindingProperty != null && bindingProperty.OwnerType == typeof(Internal.VisualStateHelper))
             {
                 _iconPresenter.Foreground = IconForeground;
             }
         }
         else
         {
             var bindingProperty = BindingOperations.GetBinding(Source, IconHelper.ForegroundProperty)?.Path?.PathParameters?.FirstOrDefault() as DependencyProperty;
             if (bindingProperty != null && bindingProperty.OwnerType == typeof(Internal.VisualStateHelper))
             {
                 FrameworkElementUtil.BindingProperty(_iconPresenter, IconPresenter.ForegroundProperty, Source, IconHelper.ForegroundProperty);
             }
         }
     }
 }
コード例 #2
0
        private void ValidateCurrentStateItem()
        {
            if (!IsInitialized)
            {
                return;
            }

            foreach (var item in Items)
            {
                if (item == null)
                {
                    continue;
                }

                if (VerifyState(item.State))
                {
                    FrameworkElementUtil.BindingProperty(this, ContentProperty, item, StateItem.ContentProperty);
                    FrameworkElementUtil.BindingProperty(this, ContentTemplateProperty, item, StateItem.ContentTemplateProperty);
                    FrameworkElementUtil.BindingProperty(this, ContentTemplateSelectorProperty, item, StateItem.ContentTemplateSelectorProperty);
                    break;
                }
            }
        }
コード例 #3
0
        private static void OnRegistChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var element = (FrameworkElement)d;

            FrameworkElementUtil.BindingProperty(element, BackgroundProperty, element, Control.BackgroundProperty);
            if (element is TabItem)
            {
                FrameworkElementUtil.BindingProperty(element, ForegroundProperty, element, TabItemHelper.ForegroundProperty);
            }
            else
            {
                FrameworkElementUtil.BindingProperty(element, ForegroundProperty, element, Control.ForegroundProperty);
            }
            FrameworkElementUtil.BindingProperty(element, BorderBrushProperty, element, Control.BorderBrushProperty);
            if (element is CheckBox)
            {
                FrameworkElementUtil.BindingProperty(element, GlyphBrushProperty, element, CheckBoxHelper.GlyphBrushProperty);
            }
            if (element is RadioButton)
            {
                FrameworkElementUtil.BindingProperty(element, ToggleBrushProperty, element, RadioButtonHelper.ToggleBrushProperty);
            }
            FrameworkElementUtil.BindingProperty(element, BorderBrushProperty, element, Control.BorderBrushProperty);
            var effectBinding = new MultiBinding()
            {
                Converter = new DropShadowEffectWithDepthConverter(),
            };

            effectBinding.Bindings.Add(CreateBinding(ShadowColorProperty));
            effectBinding.Bindings.Add(CreateBinding(ShadowHelper.BlurRadiusProperty));
            effectBinding.Bindings.Add(CreateBinding(ShadowHelper.ShadowDepthProperty));
            effectBinding.Bindings.Add(CreateBinding(ShadowHelper.DirectionProperty));
            effectBinding.Bindings.Add(CreateBinding(ShadowHelper.OpacityProperty));
            effectBinding.Bindings.Add(CreateBinding(ShadowHelper.RenderingBiasProperty));
            element.SetBinding(EffectProperty, effectBinding);
        }
コード例 #4
0
        private void DeteminingSize()
        {
            if (_headerControl == null)
            {
                return;
            }
            var size = 0d;

            if (Orientation == Orientation.Horizontal)
            {
                size = GetComputedWidth(false);
                var internalHeight = GetComputedHeight(true);
                if (double.IsNaN(internalHeight))
                {
                    FrameworkElementUtil.BindingProperty(this, InternalHeaderHeightProperty, this, ActualHeightProperty);
                }
                else
                {
                    InternalHeaderHeight = internalHeight;
                }
            }
            else
            {
                size = GetComputedHeight(false);
                var internalWidth = GetComputedWidth(true);
                if (double.IsNaN(internalWidth))
                {
                    FrameworkElementUtil.BindingProperty(this, InternalHeaderWidthProperty, this, ActualWidthProperty);
                }
                else
                {
                    InternalHeaderWidth = internalWidth;
                }
            }
            var collectSizeEventArgs = new FormGroupCollectSizeEventArgs(Orientation, size);

            if (!string.IsNullOrEmpty(GroupName))
            {
                CollectSize?.Invoke(this, collectSizeEventArgs);
            }
            if (Orientation == Orientation.Horizontal)
            {
                if (collectSizeEventArgs.Maximuim == InternalHeaderWidth)
                {
                    return;
                }
                InternalHeaderWidth = collectSizeEventArgs.Maximuim;
            }
            else
            {
                if (collectSizeEventArgs.Maximuim == InternalHeaderHeight)
                {
                    return;
                }
                InternalHeaderHeight = collectSizeEventArgs.Maximuim;
            }
            if (!string.IsNullOrEmpty(GroupName))
            {
                var sizeDeteminedEventArgs = new FormGroupSizeDeterminedEventArgs(Orientation, collectSizeEventArgs.Maximuim);
                SizeDetemined?.Invoke(this, sizeDeteminedEventArgs);
            }
        }