Exemple #1
0
 static IconElement()
 {
     ForegroundProperty.OverrideMetadata(typeof(IconElement),
                                         new FrameworkPropertyMetadata(SystemColors.ControlTextBrush,
                                                                       FrameworkPropertyMetadataOptions.Inherits,
                                                                       (sender, e) => ((IconElement)sender).OnForegroundPropertyChanged(e)));
 }
Exemple #2
0
        private static void OnSelectionBorderVisiblityChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            var gridCell = obj as GridCell;

            // If SelectionBorderVisiblity is Visible, bind GridCell Foreground with SelectionForegroundBrush
            if (args.NewValue.Equals(Visibility.Visible))
            {
                if (gridCell.SelectionForegroundBrush != SfDataGrid.GridSelectionForgroundBrush)
                {
                    gridCell.Foreground = gridCell.SelectionForegroundBrush;
                }
                else if (SfDataGrid.GridSelectionForgroundBrush != gridCell.ColumnBase.Renderer.DataGrid.SelectionForegroundBrush)
                {
                    gridCell.Foreground = gridCell.ColumnBase.Renderer.DataGrid.SelectionForegroundBrush;
                }
#if UWP
                else if (ForegroundProperty.GetMetadata(typeof(FrameworkElement)).DefaultValue == gridCell.Foreground)
                {
                    gridCell.Foreground = SfDataGrid.GridSelectionForgroundBrush;
                }
#endif
            }
            else
            {
                gridCell.ClearValue(GridCell.ForegroundProperty);
            }
        }
        internal void UpdateSelectionForegroundBrush()
        {
            // If SelectionBorderVisiblity is Visible, bind VirtualizingCellsControl Foreground with SelectionForegroundBrush
            if (this.SelectionBorderVisiblity == Visibility.Visible)
            {
                var dataGrid = this.GetRowGenerator().Owner as SfDataGrid;
                // Assign SelectionForegroundBrush to Foreground when the SelectionForegroundBrush is set explicity of AddNewRowControl doesn't equal with SfDataGrid.GridSelectionForegroundBrush.
                if (this.SelectionForegroundBrush != SfDataGrid.GridSelectionForgroundBrush)
                {
                    this.Foreground = this.SelectionForegroundBrush;
                }
                // SelectionForegroundBrush is not to set explicitly to AddNewRowControl, then assign SfDataGrid SelectionForegroundBrush to Foreground.
                // Otherwise, Foreground Brush is set as default value of AddNewRowControl.
                else if (dataGrid.SelectionForegroundBrush != SfDataGrid.GridSelectionForgroundBrush)
                {
                    this.Foreground = dataGrid.SelectionForegroundBrush;
                }
#if UWP
                else if (ForegroundProperty.GetMetadata(typeof(FrameworkElement)).DefaultValue == this.Foreground)
                {
                    this.Foreground = SfDataGrid.GridSelectionForgroundBrush;
                }
#endif
            }
            else
            {
                this.ClearValue(VirtualizingCellsControl.ForegroundProperty);
            }
        }
 ///<summary>示波器控件</summary>
 static OscilloscopeControl()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(typeof(OscilloscopeControl)));
     ForegroundProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender, new PropertyChangedCallback((DependencyObject d, DependencyPropertyChangedEventArgs e) =>
     {
         if (e.NewValue != null)
         {
             var sender = d as OscilloscopeControl;
             if (sender != null && sender.m_IsPropertyEnabled)
             {
                 var temp = e.NewValue as SolidColorBrush;
                 if (temp != null)
                 {
                     sender.m_Core.ChangeForegroundColor(ColorHelper.ToColorValue(temp.Color));
                 }
             }
         }
     })));
     BackgroundProperty.OverrideMetadata(typeof(OscilloscopeControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender, new PropertyChangedCallback((DependencyObject d, DependencyPropertyChangedEventArgs e) =>
     {
         if (e.NewValue != null)
         {
             var sender = d as OscilloscopeControl;
             if (sender != null && sender.m_IsPropertyEnabled)
             {
                 var temp = e.NewValue as SolidColorBrush;
                 if (temp != null)
                 {
                     sender.m_Core.ChangeBackgroundColor(ColorHelper.ToColorValue(temp.Color));
                 }
             }
         }
     })));
 }
 static ExtendedTextBox()
 {
     BackgroundProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(new SolidColorBrush(Colors.White), OnBackgroundPropertyChanged));
     BorderBrushProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromArgb(0xFF, 0xAB, 0xAD, 0xB3)), OnBorderBrushPropertyChanged));
     ForegroundProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(new SolidColorBrush(Colors.Black), OnForegroundPropertyChanged));
     OpacityMaskProperty.OverrideMetadata(typeof(ExtendedTextBox), new FrameworkPropertyMetadata(null, OnOpacityMaskPropertyChanged));
 }
Exemple #6
0
 static HitTextBlock()
 {
     FontFamilyProperty.OverrideMetadata(typeof(HitTextBlock), new FrameworkPropertyMetadata(OnTextAffectingPropertyChanged));
     FontSizeProperty.OverrideMetadata(typeof(HitTextBlock), new FrameworkPropertyMetadata(OnTextAffectingPropertyChanged));
     FontWeightProperty.OverrideMetadata(typeof(HitTextBlock), new FrameworkPropertyMetadata(OnTextAffectingPropertyChanged));
     FontStyleProperty.OverrideMetadata(typeof(HitTextBlock), new FrameworkPropertyMetadata(OnTextAffectingPropertyChanged));
     ForegroundProperty.OverrideMetadata(typeof(HitTextBlock), new FrameworkPropertyMetadata(OnTextAffectingPropertyChanged));
 }
Exemple #7
0
 static MatrixView()
 {
     ForegroundProperty.OverrideMetadata(
         typeof(MatrixView),
         new FrameworkPropertyMetadata(
             SystemColors.ControlTextBrush,
             FrameworkPropertyMetadataOptions.Inherits,
             new PropertyChangedCallback(OnForegroundPropertyChanged)));
 }
Exemple #8
0
 static ProgressBar()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata(typeof(ProgressBar)));
     BackgroundProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata {
         CoerceValueCallback = CoerceBrush
     });
     ForegroundProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata {
         CoerceValueCallback = CoerceBrush
     });
 }
        static ProgressBar()
        {
            FocusableProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata(typeof(ProgressBar)));
            _dType = DependencyObjectType.FromSystemTypeInternal(typeof(ProgressBar));

            // Set default to 100.0
            RangeBase.MaximumProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata(100.0));
            ForegroundProperty.OverrideMetadata(typeof(ProgressBar), new FrameworkPropertyMetadata(OnForegroundChanged));
        }
Exemple #10
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));
 }
Exemple #11
0
        static TextBlock()
        {
            TextProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                              "",
                                              (o, e) => (o as TextBlock).TextChangedCallback(e.NewValue as string),
                                              (o, v) => (o as TextBlock).CoerceTextCallback(v as string)));

            ForegroundProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                    Brushes.Black,
                                                    (o, e) => (o as TextBlock).ForegroundChangedCallback(e.NewValue as Brush)));
        }
        static RatingSlider()
        {
            ValueProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: 0d, RecalculateRelativeValues));
            MinimumProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: 0d, RecalculateRelativeValues));
            MaximumProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: 10d, RecalculateRelativeValues));

            WidthProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: 0d, RecalculateWidth));

            ForegroundProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: null, ResolveForeground));
            BackgroundProperty.OverrideMetadata(typeof(RatingSlider), new FrameworkPropertyMetadata(defaultValue: null, ResolveBackground));
        }
Exemple #13
0
        static HexBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(typeof(HexBox)));

            FontFamilyProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
            FontStyleProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
            FontWeightProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
            FontStretchProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
            FontSizeProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
            ForegroundProperty.OverrideMetadata(typeof(HexBox), new FrameworkPropertyMetadata(OnTypographyChanged));
        }
        static TextBlock()
        {
            TextProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                              (string)Controls.TextBlock.TextProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                              (o, e) => (o as TextBlock).OnTextChanged(e.NewValue as string)));

            ForegroundProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                    (Brush)ForegroundProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                                    (o, e) => (o as TextBlock).OnForegroundChanged(e.NewValue as Brush)));

            FontSizeProperty.OverrideMetadata(typeof(TextBlock), new FrameworkPropertyMetadata(
                                                  (double)FontSizeProperty.GetMetadata(typeof(Controls.TextBlock)).DefaultValue,
                                                  (o, e) => (o as TextBlock).OnFontSizeChanged((double)e.NewValue)));
        }
Exemple #15
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)));
        }
        static FormattedListBoxItem()
        {
#if !DEBUG
            if (!System.Linq.Enumerable.SequenceEqual(
                    typeof(FormattedListBoxItem).Assembly.GetName().GetPublicKeyToken(),
                    System.Reflection.Assembly.GetEntryAssembly().GetName().GetPublicKeyToken()))
            {
                throw new Exception("You are not licensed to use PosControls.dll");
            }
#endif
            BackgroundProperty.OverrideMetadata(typeof(Brush),
                                                new FrameworkPropertyMetadata(ConfigurationManager.ListItemBackgroundBrush,
                                                                              new PropertyChangedCallback(BackgroundValueChanged)));
            ForegroundProperty.OverrideMetadata(typeof(Brush),
                                                new FrameworkPropertyMetadata(ConfigurationManager.ListItemBackgroundBrush,
                                                                              new PropertyChangedCallback(ForegroundValueChanged)));
        }
Exemple #17
0
        protected void UpdatedSelectionState(bool canApplyDefaultState = true)
        {
            var isSelected = this.IsSelected;
            var isFocused  = this.IsFocusedRow;

            if (isSelected)
            {
                this.UpdateIndentMargin();
                VisualStateManager.GoToState(this, "Selected", false);
            }
            else if (isFocused)
            {
                VisualStateManager.GoToState(this, "Focused", false);
            }
            else if (canApplyDefaultState)
            {
                VisualStateManager.GoToState(this, "Unselected", false);
            }

            if (isSelected)
            {
                var treeGrid = DataRow.TreeGrid;
                if (SelectionForeground != SfTreeGrid.GridSelectionForgroundBrush)
                {
                    Foreground = SelectionForeground;
                }
                else if (treeGrid.SelectionForeground != SfTreeGrid.GridSelectionForgroundBrush)
                {
                    Foreground = treeGrid.SelectionForeground;
                }
#if UWP
                else if (ForegroundProperty.GetMetadata(typeof(FrameworkElement)).DefaultValue == Foreground)
                {
                    Foreground = SfTreeGrid.GridSelectionForgroundBrush;
                }
#endif
            }
            else
            {
                ClearValue(TreeGridRowControl.ForegroundProperty);
            }
        }
Exemple #18
0
        public EditorTextBox()
        {
            ForegroundProperty.OverrideMetadata(typeof(EditorTextBox),
                                                new FrameworkPropertyMetadata(Brushes.Transparent, OnForegroundChanged));

            BackgroundProperty.OverrideMetadata(typeof(EditorTextBox),
                                                new FrameworkPropertyMetadata(OnBackgroundChanged));

            Loaded += EditorTextBox_Loaded;
            HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            AcceptsTab    = true;
            AcceptsReturn = true;

            HighlightText              = new NotifyableWordCollection();
            HighlightText.ListChanged += HighlightText_ListChanged;
            TabSize = 4;

            InitializeComponent();
        }
 static HyperlinkButton()
 {
     ForegroundProperty.AddOwner(typeof(HyperlinkButton), new PropertyMetadata(new SolidColorBrush(AppercodeColors.Blue)));
 }
Exemple #20
0
 get => (Brush)GetValue(ForegroundProperty); set => SetValue(ForegroundProperty, value);
Exemple #21
0
 static BitmapIcon()
 {
     ForegroundProperty.OverrideMetadata(typeof(BitmapIcon), new FrameworkPropertyMetadata(OnForegroundChanged));
 }
Exemple #22
0
 static Spinner()
 {
     ForegroundProperty.OverrideMetadata(typeof(Spinner), new FrameworkPropertyMetadata(Brushes.Pink));
 }
 static ProgressRing()
 {
     ForegroundProperty.AddOwner(typeof(ProgressRing), new PropertyMetadata(new SolidColorBrush(AppercodeColors.White)));
 }
Exemple #24
0
 static MaterialTextBox()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialTextBox), new FrameworkPropertyMetadata(typeof(MaterialTextBox)));
     ForegroundProperty.OverrideMetadata(typeof(MaterialTextBox), new FrameworkPropertyMetadata(null, OnForegroundChanged));
 }
Exemple #25
0
 static SimpleButton()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(SimpleButton), new FrameworkPropertyMetadata(typeof(SimpleButton)));
     ForegroundProperty.OverrideMetadata(typeof(SimpleButton), new FrameworkPropertyMetadata(OnForegroundChanged));
 }
Exemple #26
0
 static ShipLevelChart()
 {
     BackgroundProperty.OverrideMetadata(typeof(ShipLevelChart), new FrameworkPropertyMetadata(ParamsChanges));
     ForegroundProperty.OverrideMetadata(typeof(ShipLevelChart), new FrameworkPropertyMetadata(ParamsChanges));
 }
 set => SetValue(ForegroundProperty, value);
 static BeatVisualizer()
 {
     ForegroundProperty.OverrideMetadata(typeof(BeatVisualizer), new FrameworkPropertyMetadata(Brushes.Magenta));
 }