Beispiel #1
0
        // Element.Loaded -> OnLoaded
        protected override void OnLoaded(FrameworkElement adornedElement)
        {
#if DEBUG
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                this.Visibility = Visibility.Collapsed;
            }
#endif

            // 디자인 모드 변경 이벤트 등록
            DesignModeProperty.AddValueChanged(this, DesignMode_Changed);

            // Element - VerticalAlignment
            VerticalAlignmentProperty.AddValueChanged(AdornedElement, AlignmentChanged);

            // Element - HorizontalAlignment
            HorizontalAlignmentProperty.AddValueChanged(AdornedElement, AlignmentChanged);

            InitializeComponents();
            InitializeSelector();

            Parent = AdornedElement.Parent.GetRenderer();

            SelectionBrush = ResourceManager.GetBrush("Flat.Accent.Dark");
            FrameBrush     = ResourceManager.GetBrush("Flat.Accent.Light");
            HighlightBrush = Brushes.Red;// ResourceManager.GetBrush("Flat.Accent.DeepDark");

            // 스냅라인 등록
            Storyboard.GuideLayer.Add(this);

            UpdateParentState();
        }
Beispiel #2
0
        static ApplicationBar()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(typeof(ApplicationBar)));

            var itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(ApplicationBarPanel)));

            itemsPanelTemplate.Seal();
            ItemsPanelProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(itemsPanelTemplate));

            IsTabStopProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(false));
            FocusableProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(false));
            FocusManager.IsFocusScopeProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(true));
            KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(
                typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
            KeyboardNavigation.TabNavigationProperty.OverrideMetadata(
                typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
            KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(
                typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once));

            HorizontalAlignmentProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
            VerticalAlignmentProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(VerticalAlignment.Bottom));

            EventManager.RegisterClassHandler(typeof(ApplicationBar), Mouse.LostMouseCaptureEvent,
                                              new MouseEventHandler(OnLostMouseCapture));
            EventManager.RegisterClassHandler(typeof(ApplicationBar), Mouse.PreviewMouseUpOutsideCapturedElementEvent,
                                              new MouseButtonEventHandler(OnPreviewMouseButtonOutsideCapturedElement));
        }
Beispiel #3
0
        static MyComboBoxItem()
        {
            HorizontalAlignmentProperty.OverrideMetadata(typeof(MyComboBoxItem), new FrameworkPropertyMetadata(HorizontalAlignment.Left));
            VerticalAlignmentProperty.OverrideMetadata(typeof(MyComboBoxItem), new FrameworkPropertyMetadata(VerticalAlignment.Center));

            EventManager.RegisterClassHandler(typeof(MyComboBoxItem), LoadedEvent, new RoutedEventHandler(OnLoaded));
        }
 static IconPresenter()
 {
     FocusableProperty.OverrideMetadata(typeof(IconPresenter), new FrameworkPropertyMetadata(false));
     ContentTemplateSelectorProperty.OverrideMetadata(typeof(IconPresenter), new FrameworkPropertyMetadata(new IconPresenterContentTemplateSelector()));
     VerticalAlignmentProperty.OverrideMetadata(typeof(IconPresenter), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(IconPresenter), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
 }
Beispiel #5
0
 /// <summary>
 /// Static constructor
 /// </summary>
 static WindowSteeringHelperControl()
 {
     BackgroundProperty.OverrideMetadata(typeof(WindowSteeringHelperControl), new FrameworkPropertyMetadata(Brushes.Transparent));
     IsHitTestVisibleProperty.OverrideMetadata(typeof(WindowSteeringHelperControl), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(WindowSteeringHelperControl), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
     VerticalAlignmentProperty.OverrideMetadata(typeof(WindowSteeringHelperControl), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
 }
Beispiel #6
0
        static ShinyImageControl()
        {
            VerticalAlignmentProperty.OverrideMetadata(typeof(ShinyImageControl), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
            HorizontalAlignmentProperty.OverrideMetadata(typeof(ShinyImageControl), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
            RenderOptions.BitmapScalingModeProperty.OverrideMetadata(typeof(ShinyImageControl), new FrameworkPropertyMetadata(BitmapScalingMode.Linear));

            _glareBrush = new LinearGradientBrush()
            {
                StartPoint    = new Point(0.5, 0.4),
                EndPoint      = new Point(0.65, 0.85),
                GradientStops =
                {
                    new GradientStop(Color.FromArgb(51, 255, 255, 255), 0.0),
                    new GradientStop(Color.FromArgb(51, 255, 255, 255), 0.6),
                    new GradientStop(Color.FromArgb(0,    0,   0,   0), 0.6),
                },
            };

            var bi = new BitmapImage();

            bi.BeginInit();
            bi.CacheOption      = BitmapCacheOption.OnLoad;
            bi.DecodePixelWidth = 100;
            bi.UriSource        = new Uri(@"pack://application:,,,/Resources/Images/avatar_background.png");
            bi.EndInit();

            _avatarBrush = new ImageBrush(bi);
            _avatarBrush.Freeze();
        }
 static MediaPlayer()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(typeof(MediaPlayer)));
     BackgroundProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(Brushes.Black));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
     VerticalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
     ContentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(ContentChanged, CoerceContent));
 }
Beispiel #8
0
        static RangePanel()
        {
            ClipToBoundsProperty.OverrideMetadata(typeof(RangePanel), new FrameworkPropertyMetadata(true));

            HorizontalAlignmentProperty.OverrideMetadata(typeof(RangePanel), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));

            VerticalAlignmentProperty.OverrideMetadata(typeof(RangePanel), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Windows.Controls.Control"/> class.
 /// </summary>
 /// <remarks></remarks>
 static QrCodeImgControl()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(QrCodeImgControl),
                                              new FrameworkPropertyMetadata(typeof(QrCodeImgControl)));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(QrCodeImgControl),
                                                  new FrameworkPropertyMetadata(HorizontalAlignment.Center));
     VerticalAlignmentProperty.OverrideMetadata(typeof(QrCodeImgControl),
                                                new FrameworkPropertyMetadata(VerticalAlignment.Center));
 }
Beispiel #10
0
 static JumpSideAppBar()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(JumpSideAppBar), new FrameworkPropertyMetadata(typeof(JumpSideAppBar)));
     WidthProperty.OverrideMetadata(typeof(JumpSideAppBar), new FrameworkPropertyMetadata(Convert.ToDouble(48)));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(JumpSideAppBar), new FrameworkPropertyMetadata(HorizontalAlignment.Left));
     VerticalAlignmentProperty.OverrideMetadata(typeof(JumpSideAppBar), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
     MarginProperty.OverrideMetadata(typeof(JumpSideAppBar), new FrameworkPropertyMetadata(new Thickness(0, 40, 0, 0)));
     EventManager.RegisterClassHandler(typeof(JumpSideAppBar), SizeChangedEvent, new RoutedEventHandler(OnLoaded));
 }
Beispiel #11
0
 static JumpComboBox()
 {
     // Specify veritical margins in the root Stackpanel.
     MarginProperty.OverrideMetadata(typeof(JumpComboBox), new FrameworkPropertyMetadata(new Thickness(0, 4, 4, 4)));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(JumpComboBox), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
     VerticalAlignmentProperty.OverrideMetadata(typeof(JumpComboBox), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
     //BackgroundProperty.OverrideMetadata(typeof(JumpComboBox), new FrameworkPropertyMetadata(Brushes.Transparent));
     EventManager.RegisterClassHandler(typeof(JumpComboBox), SizeChangedEvent, new RoutedEventHandler(OnSizeChanged));
 }
Beispiel #12
0
 static MapScale()
 {
     IsHitTestVisibleProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(false));
     MinWidthProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(100d));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(HorizontalAlignment.Right));
     VerticalAlignmentProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(VerticalAlignment.Bottom));
     StrokeStartLineCapProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(PenLineCap.Round));
     StrokeEndLineCapProperty.OverrideMetadata(typeof(MapScale), new FrameworkPropertyMetadata(PenLineCap.Round));
 }
        static WindowNotificationManager()
        {
            PseudoClass <WindowNotificationManager, NotificationPosition>(PositionProperty, x => x == NotificationPosition.TopLeft, ":topleft");
            PseudoClass <WindowNotificationManager, NotificationPosition>(PositionProperty, x => x == NotificationPosition.TopRight, ":topright");
            PseudoClass <WindowNotificationManager, NotificationPosition>(PositionProperty, x => x == NotificationPosition.BottomLeft, ":bottomleft");
            PseudoClass <WindowNotificationManager, NotificationPosition>(PositionProperty, x => x == NotificationPosition.BottomRight, ":bottomright");

            HorizontalAlignmentProperty.OverrideDefaultValue <WindowNotificationManager>(Layout.HorizontalAlignment.Stretch);
            VerticalAlignmentProperty.OverrideDefaultValue <WindowNotificationManager>(Layout.VerticalAlignment.Stretch);
        }
Beispiel #14
0
 static MediaPlayer()
 {
     BackgroundProperty.OverrideMetadata(typeof(MediaPlayer),
                                         new StyledPropertyMetadata <IBrush?>(new Optional <IBrush?>(Brushes.Black)));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer),
                                                  new StyledPropertyMetadata <HorizontalAlignment>(HorizontalAlignment.Stretch));
     VerticalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer),
                                                new StyledPropertyMetadata <VerticalAlignment>(VerticalAlignment.Stretch));
     ContentProperty.Changed.Subscribe(ContentChanged);
 }
Beispiel #15
0
 static LayoutGridResizerControl()
 {
     //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(LayoutGridResizerControl), new FrameworkPropertyMetadata(typeof(LayoutGridResizerControl)));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
     VerticalAlignmentProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
     BackgroundProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(Brushes.Transparent));
     IsHitTestVisibleProperty.OverrideMetadata(typeof(LayoutGridResizerControl), new FrameworkPropertyMetadata(true, null));
 }
Beispiel #16
0
 static Resizer()
 {
     //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(Resizer), new FrameworkPropertyMetadata(typeof(Resizer)));
     MinWidthProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
     MinHeightProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
     VerticalAlignmentProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
 }
Beispiel #17
0
        static FlexPanel()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(FlexPanel),
                                                     new FrameworkPropertyMetadata(typeof(FlexPanel)));

            HorizontalAlignmentProperty.OverrideMetadata(typeof(FlexPanel),
                                                         new FrameworkPropertyMetadata(HorizontalAlignment.Left));
            VerticalAlignmentProperty.OverrideMetadata(typeof(FlexPanel),
                                                       new FrameworkPropertyMetadata(VerticalAlignment.Top));
        }
Beispiel #18
0
 static BlackKey()
 {
     BackgroundProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(Brushes.Black));
     DefaultStyleKeyProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(typeof(BlackKey)));
     ForegroundProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(Brushes.White));
     HeightProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(95.0));
     MarginProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(new Thickness(-100.0, 0, -100.0, 0.0)));
     VerticalAlignmentProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(VerticalAlignment.Top));
     WidthProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(11.0));
     Panel.ZIndexProperty.OverrideMetadata(typeof(BlackKey), new FrameworkPropertyMetadata(1));
 }
Beispiel #19
0
        void Detach()
        {
            _contentProperty.Detach(OnContentChanged);
            _wrapProperty.Detach(OnLayoutPropertyChanged);
            _scrollProperty.Detach(OnLayoutPropertyChanged);

            HorizontalAlignmentProperty.Detach(OnLayoutPropertyChanged);
            VerticalAlignmentProperty.Detach(OnLayoutPropertyChanged);
            FontFamilyProperty.Detach(OnFontChanged);
            FontSizeProperty.Detach(OnFontChanged);

            HorizontalContentAlignmentProperty.Detach(OnLayoutPropertyChanged);
            VerticalContentAlignmentProperty.Detach(OnLayoutPropertyChanged);
        }
        static TabItem()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TabItem), new FrameworkPropertyMetadata(typeof(TabItem)));
            HorizontalAlignmentProperty.OverrideMetadata(typeof(TabItem), new FrameworkPropertyMetadata()
            {
                DefaultValue        = HorizontalAlignment.Stretch,
                CoerceValueCallback = OnCoerceHorizontalAlignment
            });

            VerticalAlignmentProperty.OverrideMetadata(typeof(TabItem), new FrameworkPropertyMetadata()
            {
                DefaultValue        = VerticalAlignment.Bottom,
                CoerceValueCallback = OnCoerceVerticalAlignment,
            });
        }
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            // Get the base Control dependency property tests
            IList <DependencyPropertyTestMethod> tests = TagInherited(base.GetDependencyPropertyTests());

            // Remove the tests requiring templates inherited from properties
            // on FrameworkElementTest
            tests.RemoveTests(HorizontalAlignmentProperty.TemplateBindTest);
            tests.RemoveTests(HorizontalAlignmentProperty.DoesNotChangeVisualStateTest(HorizontalAlignment.Left, HorizontalAlignment.Right));
            tests.RemoveTests(HorizontalAlignmentProperty.InvalidValueDoesNotChangeVisualStateTest);
            tests.RemoveTests(VerticalAlignmentProperty.TemplateBindTest);
            tests.RemoveTests(VerticalAlignmentProperty.DoesNotChangeVisualStateTest(VerticalAlignment.Bottom, VerticalAlignment.Center));
            tests.RemoveTests(VerticalAlignmentProperty.InvalidValueDoesNotChangeVisualStateTest);

            return(tests);
        }
Beispiel #22
0
        void Attach()
        {
            _contentProperty.Attach(OnContentChanged);
            _wrapProperty.Attach(OnLayoutPropertyChanged);
            _textTrimmingProperty.Attach(OnLayoutPropertyChanged);
            _scrollProperty.Attach(OnLayoutPropertyChanged);
            _scrollSpeedProperty.Attach(OnLayoutPropertyChanged);
            _scrollDelayProperty.Attach(OnLayoutPropertyChanged);

            HorizontalAlignmentProperty.Attach(OnLayoutPropertyChanged);
            VerticalAlignmentProperty.Attach(OnLayoutPropertyChanged);
            FontFamilyProperty.Attach(OnFontChanged);
            FontSizeProperty.Attach(OnFontChanged);

            HorizontalContentAlignmentProperty.Attach(OnLayoutPropertyChanged);
            VerticalContentAlignmentProperty.Attach(OnLayoutPropertyChanged);
        }
Beispiel #23
0
        static JumpTopAppBar()
        {
            DefaultStyleKeyProperty
            .OverrideMetadata(typeof(JumpTopAppBar), new FrameworkPropertyMetadata(typeof(JumpTopAppBar)));
            BackgroundProperty
            .OverrideMetadata(typeof(JumpTopAppBar), new FrameworkPropertyMetadata(Brushes.Transparent));
            HeightProperty
            .OverrideMetadata(typeof(JumpTopAppBar), new FrameworkPropertyMetadata(Convert.ToDouble(40)));
            HorizontalAlignmentProperty
            .OverrideMetadata(typeof(JumpTopAppBar), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
            VerticalAlignmentProperty
            .OverrideMetadata(typeof(JumpTopAppBar), new FrameworkPropertyMetadata(VerticalAlignment.Top));

            /////////////////////////////////////////////////////////////////////////////////
            /// Routed Events:
            /////////////////////////////////////////////////////////////////////////////////
            EventManager.RegisterClassHandler(typeof(JumpTopAppBar), SizeChangedEvent, new RoutedEventHandler(OnLoaded));
        }
Beispiel #24
0
        static ProgressBar()
        {
            ValueProperty.Changed.AddClassHandler <ProgressBar>(x => x.ValueChanged);

            HorizontalAlignmentProperty.OverrideDefaultValue <ProgressBar>(HorizontalAlignment.Left);
            VerticalAlignmentProperty.OverrideDefaultValue <ProgressBar>(VerticalAlignment.Top);

            IsIndeterminateProperty.Changed.AddClassHandler <ProgressBar>(
                (p, e) => { if (p._indicator != null)
                            {
                                p.UpdateIsIndeterminate((bool)e.NewValue);
                            }
                });
            OrientationProperty.Changed.AddClassHandler <ProgressBar>(
                (p, e) => { if (p._indicator != null)
                            {
                                p.UpdateOrientation((Orientation)e.NewValue);
                            }
                });
        }
Beispiel #25
0
 static InfoBlock()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(InfoBlock), new FrameworkPropertyMetadata(typeof(InfoBlock)));
     VerticalAlignmentProperty.OverrideMetadataWithDefaultValue(typeof(InfoBlock), VerticalAlignment.Top);
     HorizontalAlignmentProperty.OverrideMetadataWithDefaultValue(typeof(InfoBlock), HorizontalAlignment.Right);
 }
Beispiel #26
0
 static GridSheet()
 {
     HorizontalAlignmentProperty.OverrideMetadata(typeof(GridSheet), new FrameworkPropertyMetadata(HorizontalAlignment.Left));
     VerticalAlignmentProperty.OverrideMetadata(typeof(GridSheet), new FrameworkPropertyMetadata(VerticalAlignment.Top));
 }
 static HeaderBlock()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(HeaderBlock), new FrameworkPropertyMetadata(typeof(HeaderBlock)));
     VerticalAlignmentProperty.OverrideMetadataWithDefaultValue(typeof(HeaderBlock), VerticalAlignment.Center);
     HorizontalAlignmentProperty.OverrideMetadataWithDefaultValue(typeof(HeaderBlock), HorizontalAlignment.Left);
 }
Beispiel #28
0
 static WindowNotificationManager()
 {
     HorizontalAlignmentProperty.OverrideDefaultValue <WindowNotificationManager>(Layout.HorizontalAlignment.Stretch);
     VerticalAlignmentProperty.OverrideDefaultValue <WindowNotificationManager>(Layout.VerticalAlignment.Stretch);
 }
 static StatBox()
 {
     // Change defaults for inherited dependency properties...
     HorizontalAlignmentProperty.OverrideMetadata(typeof(StatBox), new FrameworkPropertyMetadata(HorizontalAlignment.Left));
     VerticalAlignmentProperty.OverrideMetadata(typeof(StatBox), new FrameworkPropertyMetadata(VerticalAlignment.Top));
 }