Beispiel #1
0
		public StyleBase()
		{
			Width = new WidthProperty();
			Height= new HeightProperty();
			Padding = new PaddingProperty();
			Margin = new MarginProperty();
			FontSize = new FontSizeProperty();

			Color=string.Empty;
			BackgroundColor=string.Empty;
			Hidden=false;
		}
Beispiel #2
0
        static TimeScale()
        {
            WidthProperty.OverrideMetadata(typeof(TimeScale), new FrameworkPropertyMetadata(Double.NaN));
            HeightProperty.OverrideMetadata(typeof(TimeScale), new FrameworkPropertyMetadata(30d));

            ClipToBoundsProperty.OverrideMetadata(typeof(TimeScale), new FrameworkPropertyMetadata(true));
            ForegroundProperty.OverrideMetadata(typeof(TimeScale), new FrameworkPropertyMetadata(Brushes.Gray));
            BackgroundProperty.OverrideMetadata(typeof(TimeScale), new FrameworkPropertyMetadata(Brushes.Transparent));

            IntervalTextColorProperty = DependencyProperty.Register("IntervalTextColor", typeof(Brush), typeof(TimeScale),
                                                                    new FrameworkPropertyMetadata {
                DefaultValue = Brushes.Gray, AffectsRender = true
            });

            DefaultStyleKeyProperty.OverrideMetadata(typeof(TimeScale),
                                                     new FrameworkPropertyMetadata(typeof(TimeScale)));
        }
Beispiel #3
0
        /// <summary>
        /// Initializes the <see cref="WizardView" /> class.
        /// </summary>
        static WizardView()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(WizardView), new FrameworkPropertyMetadata(typeof(WizardView)));

            var widthMetadata = new FrameworkPropertyMetadata(640d, FrameworkPropertyMetadataOptions.AffectsMeasure)
            {
                CoerceValueCallback = WidthCoerceValueCallback
            };

            var heightMetadata = new FrameworkPropertyMetadata(480d, FrameworkPropertyMetadataOptions.AffectsMeasure)
            {
                CoerceValueCallback = HeightCoerceValueCallback
            };

            WidthProperty.AddOwner(typeof(WizardView), widthMetadata);
            HeightProperty.AddOwner(typeof(WizardView), heightMetadata);
        }
Beispiel #4
0
        static SideAppBar()
        {
            NameProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata("SideAppBar1"));
            DefaultStyleKeyProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata(typeof(SideAppBar)));
            WidthProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata(Convert.ToDouble(48)));
            HorizontalAlignmentProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata(HorizontalAlignment.Left));
            VerticalAlignmentProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
            MarginProperty
            .OverrideMetadata(typeof(SideAppBar), new FrameworkPropertyMetadata(new Thickness(0, 40, 0, 0)));

            /////////////////////////////////////////////////////////////////////////////////
            /// Routed Events:
            /////////////////////////////////////////////////////////////////////////////////
            EventManager.RegisterClassHandler(typeof(SideAppBar), SizeChangedEvent, new RoutedEventHandler(OnLoaded));
        }
        static ManagedContent()
        {
            //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
            //This style is defined in themes\generic.xaml
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ManagedContent),
                                                     new FrameworkPropertyMetadata(typeof(ManagedContent)));

            WidthProperty.OverrideMetadata(typeof(ManagedContent),
                                           new FrameworkPropertyMetadata(double.NaN, null, (s, v) =>
            {
                if (
                    !DesignerProperties
                    .
                    GetIsInDesignMode
                        (s))
                {
                    return(double.NaN);
                }

                return(v);
            }));
            HeightProperty.OverrideMetadata(typeof(ManagedContent),
                                            new FrameworkPropertyMetadata(double.NaN, null, (s, v) =>
            {
                if (
                    !DesignerProperties
                    .
                    GetIsInDesignMode
                        (s))
                {
                    return
                    (double.NaN);
                }

                return(v);
            }));

            FocusableProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(true));
        }
Beispiel #6
0
 /// <summary>
 /// Initializes static members of the <see cref="SACS.Windows.ExtentedControls.FixedWidthColumn"/> class.
 /// </summary>
 static FixedWidthColumn()
 {
     WidthProperty.OverrideMetadata(
         typeof(FixedWidthColumn),
         new FrameworkPropertyMetadata(null, new CoerceValueCallback(OnCoerceWidth)));
 }
 static FixedWidthGridViewColumn()
 {
     WidthProperty.OverrideMetadata(typeof(FixedWidthGridViewColumn),
                                    new FrameworkPropertyMetadata(null, OnCoerceWidth));
 }
Beispiel #8
0
 //<SnippetInvalidateProperty>
 static AreaButton()
 {
     WidthProperty.OverrideMetadata(typeof(AreaButton), new FrameworkPropertyMetadata(new PropertyChangedCallback(InvalidateAreaProperty)));
     HeightProperty.OverrideMetadata(typeof(AreaButton), new FrameworkPropertyMetadata(new PropertyChangedCallback(InvalidateAreaProperty)));
 }
Beispiel #9
0
 static TetrisCanvas()
 {
     WidthProperty.OverrideMetadata(typeof(TetrisCanvas), new FrameworkPropertyMetadata(WidthChanged));
     HeightProperty.OverrideMetadata(typeof(TetrisCanvas), new FrameworkPropertyMetadata(HeightChanged));
 }
Beispiel #10
0
        /// <summary>
        /// Updates the layout of the group.
        /// </summary>
        public override bool UpdateLayout(bool notifyParent = true)
        {
            bool defaultDisableLayoutUpdate = DisableLayoutUpdate;

            DisableLayoutUpdate = true;

            bool          hasNewSize       = false;
            float         maxWidth         = 0f;
            float         maxHeight        = 0f;
            float         totalWidth       = 0f;
            float         totalHeight      = 0f;
            bool          percentageWidth  = false;
            bool          percentageHeight = false;
            bool          isHorizontal     = Orientation == ElementOrientation.Horizontal;
            List <UIView> children         = new List <UIView>();

            this.ForEach <UIView>(x =>
            {
                children.Add(x);
            }, false);

            // get size of content and set content offsets and alignment
            var spacing    = Spacing ?? ElementSize.Default;
            int childCount = children.Count;
            int childIndex = 0;

            for (int i = 0; i < childCount; ++i)
            {
                var childView = children[i];
                if (!childView.IsActive)
                {
                    // don't group inactive views
                    continue;
                }

                var childWidth  = childView.OverrideWidth ?? (childView.Width ?? ElementSize.Default);
                var childHeight = childView.OverrideHeight ?? (childView.Height ?? ElementSize.Default);

                if (childWidth.Unit == ElementSizeUnit.Percents)
                {
                    if (isHorizontal)
                    {
                        Debug.LogWarning(String.Format("#Delight# Unable to group view \"{0}\" horizontally as it doesn't specify its width in pixels.", childView.Name));
                        continue;
                    }
                    else
                    {
                        percentageWidth = true;
                    }
                }

                if (childHeight.Unit == ElementSizeUnit.Percents)
                {
                    if (!isHorizontal)
                    {
                        Debug.LogWarning(String.Format("#Delight# Unable to group view \"{0}\" vertically as it doesn't specify its height in pixels or elements.", childView.Name));
                        continue;
                    }
                    else
                    {
                        percentageHeight = true;
                    }
                }

                bool defaultDisableChildLayoutUpdate = childView.DisableLayoutUpdate;
                childView.DisableLayoutUpdate = true;

                // set offsets and alignment
                var offset = new ElementMargin(
                    new ElementSize(isHorizontal ? totalWidth + spacing.Pixels * childIndex : 0f, ElementSizeUnit.Pixels),
                    new ElementSize(!isHorizontal ? totalHeight + spacing.Pixels * childIndex : 0f, ElementSizeUnit.Pixels));

                // set desired alignment if it is valid for the orientation otherwise use defaults
                var alignment        = ElementAlignment.Center;
                var defaultAlignment = isHorizontal ? ElementAlignment.Left : ElementAlignment.Top;
                var desiredAlignment = !ContentAlignmentProperty.IsUndefined(this) ? ContentAlignment : childView.Alignment;
                if (isHorizontal && (desiredAlignment == ElementAlignment.Top || desiredAlignment == ElementAlignment.Bottom ||
                                     desiredAlignment == ElementAlignment.TopLeft || desiredAlignment == ElementAlignment.BottomLeft))
                {
                    alignment = defaultAlignment | desiredAlignment;
                }
                else if (!isHorizontal && (desiredAlignment == ElementAlignment.Left || desiredAlignment == ElementAlignment.Right ||
                                           desiredAlignment == ElementAlignment.TopLeft || desiredAlignment == ElementAlignment.TopRight))
                {
                    alignment = defaultAlignment | desiredAlignment;
                }
                else
                {
                    alignment = defaultAlignment;
                }

                // get size of content
                if (!percentageWidth)
                {
                    totalWidth += childWidth;
                    maxWidth    = childWidth.Pixels > maxWidth ? childWidth.Pixels : maxWidth;
                }

                if (!percentageHeight)
                {
                    totalHeight += childHeight;
                    maxHeight    = childHeight.Pixels > maxHeight ? childHeight.Pixels : maxHeight;
                }

                // update child layout
                if (!offset.Equals(childView.OffsetFromParent) || alignment != childView.Alignment)
                {
                    childView.OffsetFromParent = offset;
                    childView.Alignment        = alignment;

                    childView.UpdateLayout(false);
                }
                ++childIndex;
                childView.DisableLayoutUpdate = defaultDisableChildLayoutUpdate;
            }

            // set width and height
            float totalSpacing = childCount > 1 ? (childIndex - 1) * spacing.Pixels : 0f;

            // adjust width to content
            if (WidthProperty.IsUndefined(this))
            {
                if (!percentageWidth)
                {
                    // add margins
                    var margin = Margin ?? ElementMargin.Default;
                    totalWidth += isHorizontal ? totalSpacing : 0f;
                    totalWidth += margin.Left.Pixels + margin.Right.Pixels;
                    maxWidth   += margin.Left.Pixels + margin.Right.Pixels;

                    // adjust width to content
                    var newWidth = new ElementSize(isHorizontal ? totalWidth : maxWidth, ElementSizeUnit.Pixels);
                    if (!newWidth.Equals(Width))
                    {
                        OverrideWidth = newWidth;
                        hasNewSize    = true;
                    }
                }
                else
                {
                    var newWidth = new ElementSize(1, ElementSizeUnit.Percents);
                    if (!newWidth.Equals(Width))
                    {
                        OverrideWidth = newWidth;
                        hasNewSize    = true;
                    }
                }
            }
            else if (OverrideWidth != null && !OverrideWidth.Equals(Width))
            {
                // clear override
                OverrideWidth = null;
                hasNewSize    = true;
            }

            // adjust height to content
            if (HeightProperty.IsUndefined(this))
            {
                if (!percentageHeight)
                {
                    // add margins
                    var margin = Margin ?? ElementMargin.Default;
                    totalHeight += !isHorizontal ? totalSpacing : 0f;
                    totalHeight += margin.Top.Pixels + margin.Bottom.Pixels;
                    maxHeight   += margin.Top.Pixels + margin.Bottom.Pixels;

                    // adjust height to content
                    var newHeight = new ElementSize(!isHorizontal ? totalHeight : maxHeight, ElementSizeUnit.Pixels);
                    if (!newHeight.Equals(Height))
                    {
                        OverrideHeight = newHeight;
                        hasNewSize     = true;
                    }
                }
                else
                {
                    var newHeight = new ElementSize(1, ElementSizeUnit.Percents);
                    if (!newHeight.Equals(Height))
                    {
                        OverrideHeight = newHeight;
                        hasNewSize     = true;
                    }
                }
            }
            else if (OverrideHeight != null && !OverrideHeight.Equals(Height))
            {
                // clear override
                OverrideHeight = null;
                hasNewSize     = true;
            }

            DisableLayoutUpdate = defaultDisableLayoutUpdate;

            return(base.UpdateLayout(notifyParent) || hasNewSize);
        }
Beispiel #11
0
 // Constructors
 static ColumnDefinitionExtended()
 {
     VisibleProperty = DependencyProperty.Register("Visible", typeof(Boolean), typeof(ColumnDefinitionExtended), new PropertyMetadata(true, new PropertyChangedCallback(OnVisibleChanged)));
     WidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata(new GridLength(1, GridUnitType.Star), null, new CoerceValueCallback(CoerceWidth)));
     MinWidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata((Double)0, null, new CoerceValueCallback(CoerceMinWidth)));
 }
Beispiel #12
0
 => SetValue(WidthProperty, width);
Beispiel #13
0
 // Constructors
 static HidableColumnDefinition()
 {
     VisibleProperty = DependencyProperty.Register("Visible", typeof(bool), typeof(HidableColumnDefinition), new PropertyMetadata(true, OnVisibleChanged));
     WidthProperty.OverrideMetadata(typeof(HidableColumnDefinition), new FrameworkPropertyMetadata(new GridLength(1, GridUnitType.Star), null, CoerceWidth));
     MinWidthProperty.OverrideMetadata(typeof(HidableColumnDefinition), new FrameworkPropertyMetadata((double)0, null, CoerceMinWidth));
 }
 static ResizingAdorner()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizingAdorner), new FrameworkPropertyMetadata(typeof(ResizingAdorner)));
     WidthProperty.OverrideMetadata(typeof(ResizingAdorner), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
     HeightProperty.OverrideMetadata(typeof(ResizingAdorner), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
 }
Beispiel #15
0
 static Sprite()
 {
     StretchProperty.OverrideMetadata(typeof(Sprite), new FrameworkPropertyMetadata(Stretch.Fill));
     WidthProperty.OverrideMetadata(typeof(Sprite), new FrameworkPropertyMetadata(1));
     HeightProperty.OverrideMetadata(typeof(Sprite), new FrameworkPropertyMetadata(1));
 }
Beispiel #16
0
 public virtual TResult Visit(WidthProperty property, TEnvironment environment)
 {
     property.Value.Accept(this, environment);
     return(default(TResult));
 }
Beispiel #17
0
 static Caret()
 {
     WidthProperty.OverrideMetadata(typeof(Caret), new FrameworkPropertyMetadata(2.0, FrameworkPropertyMetadataOptions.AffectsRender));
 }
Beispiel #18
0
 static Window()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window)));
     WidthProperty.OverrideMetadata(typeof(Window), new PropertyMetadata(WidthChanged));
     HeightProperty.OverrideMetadata(typeof(Window), new PropertyMetadata(HeightChanged));
 }
Beispiel #19
0
        public void CreatingNewObject_ShouldHaveCorrectValueIfCorectDataGiven()
        {
            var actual = new WidthProperty(new IntegerLiteral(42));

            Assert.Equal(42, actual.Value.Value);
        }
Beispiel #20
0
 public virtual TResult Visit(WidthProperty expression, TEnvironment environment)
 {
     expression.Value.Accept(this, environment);
     return(default(TResult));
 }
Beispiel #21
0
 /// <summary>
 /// Static Constructor.
 /// </summary>
 static InnerListColumn()
 {
     WidthProperty.OverrideMetadata(typeof(InnerListColumn), new FrameworkPropertyMetadata(null, WidthProperty_CoerceProperty));
 }
Beispiel #22
0
 static UnresizableGridViewColumn()
 {
     WidthProperty.OverrideMetadata(typeof(UnresizableGridViewColumn),
                                    new FrameworkPropertyMetadata(null, new CoerceValueCallback(OnCoerceWidth)));
 }
Beispiel #23
0
 static DrawingIcon()
 {
     WidthProperty.OverrideDefaultValue <DrawingIcon>(16);
     HeightProperty.OverrideDefaultValue <DrawingIcon>(16);
 }
 /// <summary>
 /// Initializes static members of the <see cref="Magnifier"/> class.
 /// </summary>
 static Magnifier()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(Magnifier), new FrameworkPropertyMetadata(typeof(Magnifier)));
     HeightProperty.OverrideMetadata(typeof(Magnifier), new FrameworkPropertyMetadata(Magnifier.DEFAULT_SIZE));
     WidthProperty.OverrideMetadata(typeof(Magnifier), new FrameworkPropertyMetadata(Magnifier.DEFAULT_SIZE));
 }
Beispiel #25
0
 // Einrichten der Control-Klasse
 static ValidationSummary()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(ValidationSummary), new FrameworkPropertyMetadata(typeof(ValidationSummary)));
     WidthProperty.OverrideMetadata(typeof(ValidationSummary), new FrameworkPropertyMetadata(300.0));
 }
Beispiel #26
0
 static ImageButton()
 {
     WidthProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(20.0));
     HeightProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(20.0));
 }
Beispiel #27
0
 set => this.SetLocalValue(WidthProperty, value);
 static CompletionWindow()
 {
     WidthProperty.OverrideMetadata(typeof(CompletionWindow), new FrameworkPropertyMetadata(200.0));
     HeightProperty.OverrideMetadata(typeof(CompletionWindow), new FrameworkPropertyMetadata(120.0));
 }
Beispiel #29
0
 static ColumnDefinitionExtended()
 {
     WidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata(new GridLength(1, GridUnitType.Star), null, CoerceWidth));
     MinWidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata(0.0, null, CoerceMinWidth));
 }
 set => SetValue(WidthProperty, value);
Beispiel #31
0
 static ActorAvatarView()
 {
     WidthProperty.OverrideMetadata(typeof(ActorAvatarView), new FrameworkPropertyMetadata(30.0));
     HeightProperty.OverrideMetadata(typeof(ActorAvatarView), new FrameworkPropertyMetadata(30.0));
 }