Esempio n. 1
0
        static EnableImage()
        {
            SnapsToDevicePixelsProperty.OverrideMetadata(typeof(EnableImage), new FrameworkPropertyMetadata(true));
            //UseLayoutRoundingProperty.OverrideMetadata(typeof(EnableImage), new FrameworkPropertyMetadata(false));
            RenderOptions.EdgeModeProperty.OverrideMetadata(typeof(EnableImage), new FrameworkPropertyMetadata(EdgeMode.Aliased));

            SourceProperty.OverrideMetadata(typeof(EnableImage), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnSourceChanged)));
            IsEnabledProperty.OverrideMetadata(typeof(EnableImage), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(OnIsEnabledChanged)));
        }
Esempio n. 2
0
 static GlowWindow()
 {
     AllowsTransparencyProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(true));
     BackgroundProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(Brushes.Transparent));
     ResizeModeProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize));
     ShowActivatedProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(false));
     ShowInTaskbarProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(false));
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(true));
     WindowStyleProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(WindowStyle.None));
 }
Esempio n. 3
0
        /// <summary>
        ///     Instantiates global information.
        /// </summary>
        static DataGridRow()
        {
            VisibilityProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(null, OnCoerceVisibility));
            DefaultStyleKeyProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(typeof(DataGridRow)));
            ItemsPanelProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(new ItemsPanelTemplate(new FrameworkElementFactory(typeof(DataGridCellsPanel)))));
            FocusableProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(false));
            BackgroundProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(null, OnNotifyRowPropertyChanged, OnCoerceBackground));
            BindingGroupProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(OnNotifyRowPropertyChanged));

            // Set SnapsToDevicePixels to true so that this element can draw grid lines.  The metadata options are so that the property value doesn't inherit down the tree from here.
            SnapsToDevicePixelsProperty.OverrideMetadata(typeof(DataGridRow), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsArrange));
        }
Esempio n. 4
0
        /// <summary>
        ///     Instantiates global information.
        /// </summary>
        static DataGridCell()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(DataGridCell), new FrameworkPropertyMetadata(typeof(DataGridCell)));
            StyleProperty.OverrideMetadata(typeof(DataGridCell), new FrameworkPropertyMetadata(null, OnNotifyPropertyChanged, OnCoerceStyle));
            ClipProperty.OverrideMetadata(typeof(DataGridCell), new FrameworkPropertyMetadata(null, new CoerceValueCallback(OnCoerceClip)));
            KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(DataGridCell), new FrameworkPropertyMetadata(KeyboardNavigationMode.Local));

            // Set SnapsToDevicePixels to true so that this element can draw grid lines.  The metadata options are so that the property value doesn't inherit down the tree from here.
            SnapsToDevicePixelsProperty.OverrideMetadata(typeof(DataGridCell), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsArrange));

            EventManager.RegisterClassHandler(typeof(DataGridCell), MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnAnyMouseLeftButtonDownThunk), true);
        }
Esempio n. 5
0
        static GameScreenBase()
        {
            AppContextProperty = GameScreenViewBase.AppContextProperty.AddOwner(typeof(GameScreenBase));

            SnapsToDevicePixelsProperty.OverrideMetadata(
                typeof(GameScreenBase),
                new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));

            IsTabStopProperty.OverrideMetadata(
                typeof(GameScreenBase),
                new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));

            ChatMessageReceivedEvent = EventManager.RegisterRoutedEvent(
                "ChatMessageReceived",
                RoutingStrategy.Direct,
                typeof(RoutedEventHandler),
                typeof(GameScreenBase));
        }
Esempio n. 6
0
        static GamePopupRoot()
        {
            SnapsToDevicePixelsProperty.OverrideMetadata(
                typeof(GamePopupRoot),
                new FrameworkPropertyMetadata(true));

            CommandManager.RegisterClassCommandBinding(
                typeof(GamePopupRoot),
                new CommandBinding(
                    GamePopup.ClosePopupCommand,
                    (sender, args) =>
            {
                var popup           = (GamePopupRoot)sender;
                popup._popup.IsOpen = false;
                args.Handled        = true;
            },
                    (sender, args) =>
            {
                var popup       = (GamePopupRoot)sender;
                args.CanExecute = popup._popup.IsOpen;
                args.Handled    = true;
            }));
        }
 static DataGridHeaderBorder()
 {
     // We always set this to true on these borders, so just default it to true here.
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(DataGridHeaderBorder), new FrameworkPropertyMetadata(true));
 }
Esempio n. 8
0
 static OutlineText()
 {
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(OutlineText), new FrameworkPropertyMetadata(ValueBoxes.TrueBox));
     UseLayoutRoundingProperty.OverrideMetadata(typeof(OutlineText), new FrameworkPropertyMetadata(ValueBoxes.TrueBox));
 }
Esempio n. 9
0
 static SVGImage()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(SVGImage), new FrameworkPropertyMetadata(typeof(SVGImage)));
     ClipToBoundsProperty.OverrideMetadata(typeof(SVGImage), new FrameworkPropertyMetadata(true));
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(SVGImage), new FrameworkPropertyMetadata(true));
 }
Esempio n. 10
0
 static Ruler()
 {
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(Ruler <T>), new FrameworkPropertyMetadata(true));
 }
Esempio n. 11
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------
        #region Constructors

        static TickBar()
        {
            SnapsToDevicePixelsProperty.OverrideMetadata(typeof(TickBar), new FrameworkPropertyMetadata(true));
        }
Esempio n. 12
0
        static RangeBar()
        {
            DecrementCommand = new RoutedCommand("Decrement", typeof(RangeBar));
            IncrementCommand = new RoutedCommand("Increment", typeof(RangeBar));

            BlockCountProperty = DependencyProperty.Register(
                "BlockCount",
                typeof(int),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    5,
                    FrameworkPropertyMetadataOptions.AffectsRender,
                    null,
                    CoerceBlockCount));

            BlockMarginProperty = DependencyProperty.Register(
                "BlockMargin",
                typeof(double),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    (double)0,
                    FrameworkPropertyMetadataOptions.AffectsRender,
                    null,
                    CoerceBlockMargin));

            BlockBrushProperty = DependencyProperty.Register(
                "BlockBrush",
                typeof(Brush),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    Brushes.Yellow,
                    FrameworkPropertyMetadataOptions.AffectsRender,
                    null,
                    CoerceBlockBrush));

            FocusVisualStyleProperty.OverrideMetadata(
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    null,
                    FrameworkPropertyMetadataOptions.None,
                    null,
                    (d, value) => null));

            ClipToBoundsProperty.OverrideMetadata(
                typeof(RangeBar),
                new FrameworkPropertyMetadata(true));

            SnapsToDevicePixelsProperty.OverrideMetadata(
                typeof(RangeBar),
                new FrameworkPropertyMetadata(true));

            IsReadOnlyProperty = DependencyProperty.Register(
                "IsReadOnly",
                typeof(bool),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(false));

            PrecisionProperty = DependencyProperty.Register(
                "Precision",
                typeof(int),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    2,
                    null,
                    (d, baseValue) => ((int)baseValue < 0) ? 0 : (int)baseValue));

            IsSnappingEnabledProperty = DependencyProperty.Register(
                "IsSnappingEnabled",
                typeof(bool),
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    false,
                    (d, e) => d.CoerceValue(ValueProperty)));

            SmallChangeProperty.OverrideMetadata(
                typeof(RangeBar),
                new FrameworkPropertyMetadata(0.01));

            ValueProperty.OverrideMetadata(
                typeof(RangeBar),
                new FrameworkPropertyMetadata(
                    0.0,
                    FrameworkPropertyMetadataOptions.AffectsRender,
                    null,
                    CoerceValueProperty));
        }
Esempio n. 13
0
 static PopupRoot()
 {
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(PopupRoot), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox));
 }
Esempio n. 14
0
 static VerticalIndicator()
 {
     SnapsToDevicePixelsProperty.OverrideMetadata(typeof(VerticalIndicator), new FrameworkPropertyMetadata(true));
 }
        static GridViewColumnHeaderChrome()
        {
            SnapsToDevicePixelsProperty.OverrideMetadata(
                typeof(GridViewColumnHeaderChrome), new FrameworkPropertyMetadata(true));

            NormalBorderPen = new Lazy <Pen>(
                () => {
                var pen = new Pen {
                    Thickness = 1.0, Brush = Brushes.Transparent
                };
                pen.Freeze();
                return(pen);
            });

            InnerBorderPen = new Lazy <Pen>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xFD, 0xFE, 0xFF),
                    Color.FromArgb(0xFF, 0xFC, 0xFD, 0xFE),
                    90);
                brush.Freeze();
                var pen = new Pen(brush, 1);
                pen.Freeze();
                return(pen);
            });

            SeparatorPen = new Lazy <Pen>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xDE, 0xE9, 0xF7),
                    Color.FromArgb(0x00, 0xDE, 0xE9, 0xF7),
                    90);
                brush.Freeze();
                var pen = new Pen(brush, 1);
                pen.Freeze();
                return(pen);
            });

            PressedBorderPen = new Lazy <Pen>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xC0, 0xCB, 0xD9),
                    Color.FromArgb(0xFF, 0xC0, 0xCB, 0xD9),
                    90);
                brush.Freeze();
                var pen = new Pen(brush, 1)
                {
                    StartLineCap = PenLineCap.Square,
                    EndLineCap   = PenLineCap.Square
                };
                pen.Freeze();
                return(pen);
            });
            PressedBackgroundBrush = new Lazy <Brush>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xF6, 0xF7, 0xF8),
                    Color.FromArgb(0xFF, 0xF6, 0xF7, 0xF8),
                    90);
                brush.Freeze();
                return(brush);
            });
            PressedHighlightBrush = new Lazy <Brush>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xC1, 0xCC, 0xDA),
                    Color.FromArgb(0xFF, 0xEB, 0xEE, 0xF2),
                    90);
                brush.Freeze();
                return(brush);
            });

            HoveredBorderPen = new Lazy <Pen>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xDE, 0xE9, 0xF7),
                    Color.FromArgb(0xFF, 0xE3, 0xE8, 0xEE),
                    90);
                brush.Freeze();
                var pen = new Pen(brush, 1)
                {
                    StartLineCap = PenLineCap.Square,
                    EndLineCap   = PenLineCap.Square
                };
                pen.Freeze();
                return(pen);
            });
            HoveredBackgroundBrush = new Lazy <Brush>(
                () => {
                var brush = new LinearGradientBrush(
                    Color.FromArgb(0xFF, 0xF3, 0xF8, 0xFD),
                    Color.FromArgb(0xFF, 0xEF, 0xF3, 0xF9),
                    90);
                brush.Freeze();
                return(brush);
            });

            ArrowUpGeometry = new Lazy <PathGeometry>(
                () => {
                var geometry      = new PathGeometry();
                var figure        = new PathFigure();
                figure.StartPoint = new Point(0.0, 4.0);
                var segment       = new LineSegment(new Point(3.5, 0.0), false);
                segment.Freeze();
                figure.Segments.Add(segment);
                segment = new LineSegment(new Point(7.0, 4.0), false);
                segment.Freeze();
                figure.Segments.Add(segment);
                figure.IsClosed = true;
                figure.Freeze();
                geometry.Figures.Add(figure);
                geometry.Freeze();
                return(geometry);
            });
            ArrowDownGeometry = new Lazy <PathGeometry>(
                () => {
                var geometry      = new PathGeometry();
                var figure        = new PathFigure();
                figure.StartPoint = new Point(0.0, 0.0);
                var segment       = new LineSegment(new Point(7.0, 0.0), false);
                segment.Freeze();
                figure.Segments.Add(segment);
                segment = new LineSegment(new Point(3.5, 4.0), false);
                segment.Freeze();
                figure.Segments.Add(segment);
                figure.IsClosed = true;
                figure.Freeze();
                geometry.Figures.Add(figure);
                geometry.Freeze();
                return(geometry);
            });
            ArrowBorderBrush = new Lazy <Brush>(
                () => {
                var brush = new LinearGradientBrush {
                    StartPoint = new Point(),
                    EndPoint   = new Point(1, 1)
                };
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x3C, 0x5E, 0x72), 0.0));
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x3C, 0x5E, 0x72), 0.1));
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xC3, 0xE4, 0xF5), 1.0));
                brush.Freeze();
                return(brush);
            });
            ArrowFillBrush = new Lazy <Brush>(
                () => {
                var brush = new LinearGradientBrush {
                    StartPoint = new Point(),
                    EndPoint   = new Point(1, 1)
                };
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x61, 0x96, 0xB6), 0.0));
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x61, 0x96, 0xB6), 0.1));
                brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xCA, 0xE6, 0xF5), 1.0));
                brush.Freeze();
                return(brush);
            });
            ArrowFillScale = new Lazy <Transform>(
                () => {
                var transform = new ScaleTransform(0.75, 0.75, 3.5, 4);
                transform.Freeze();
                return(transform);
            });
        }