Esempio n. 1
0
        private static void OnCellHAlignChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T>      _context  = (DsxRowCell <T>)d;
            HorizontalAlignment _newValue = (HorizontalAlignment)e.NewValue;
            HorizontalAlignment _oldValue = (HorizontalAlignment)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsTextBlock || _context.IsProgressBar)
                {
                    TextAlignment _textAlignment = TextAlignment.Left;

                    switch (_newValue)
                    {
                    case HorizontalAlignment.Left:      _textAlignment = TextAlignment.Left;     break;

                    case HorizontalAlignment.Right:     _textAlignment = TextAlignment.Right;    break;

                    case HorizontalAlignment.Center:    _textAlignment = TextAlignment.Center;   break;
                    }
                    _context.CellTextAlignment = _textAlignment;
                }
                else if (_context.Child != null)
                {
                    (_context.Child as FrameworkElement).HorizontalAlignment = _newValue;
                }
            }
        }
Esempio n. 2
0
        private static void OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            bool?          _newValue = (bool?)e.NewValue;
            bool?          _oldValue = (bool?)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsBullet)
                {
                    (_context.Child as BulletChrome).IsChecked = _newValue;
                    if (_context.IsDecorator)
                    {
                        if (_newValue != null)
                        {
                            (_context.Child as BulletChrome).Opacity = 1.0;
                        }
                        else
                        {
                            (_context.Child as BulletChrome).Opacity = 0.0;
                        }
                    }
                }
                if (_context.IsCheckBox)
                {
                    (_context.Child as CheckBox).IsChecked = _newValue;
                }
            }
        }
Esempio n. 3
0
        private static void OnImgSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            ImageSource    _newValue = (ImageSource)e.NewValue;
            ImageSource    _oldValue = (ImageSource)e.OldValue;

            if (_newValue != _oldValue && _context.IsImage)
            {
                (_context.Child as Image).Source = _newValue;
            }
        }
Esempio n. 4
0
        private static void OnDsxColumnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            DsxColumn      _newValue = (DsxColumn)e.NewValue;
            DsxColumn      _oldValue = (DsxColumn)e.OldValue;

            if (_newValue != _oldValue)
            {
                _context.InitElement(_newValue, false);
            }
        }
Esempio n. 5
0
        private static void OnCellContentSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            double         _newValue = (double)e.NewValue;
            double         _oldValue = (double)e.OldValue;

            if (_newValue != _oldValue && _context.IsImage)
            {
                (_context.Child as Image).Height = _newValue;
                (_context.Child as Image).Width  = _newValue;
            }
        }
Esempio n. 6
0
        private static void OnCellRangeMaxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            double         _newValue = (double)e.NewValue;
            double         _oldValue = (double)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsProgressBar)
                {
                    (_context.Child as DsxCellProgressBar).Maximum = _newValue;
                }
            }
        }
Esempio n. 7
0
        private static void OnCellContentBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            Brush          _newValue = (Brush)e.NewValue;
            Brush          _oldValue = (Brush)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsProgressBar)
                {
                    (_context.Child as DsxCellProgressBar).ContentBackground = _newValue;
                }
            }
        }
Esempio n. 8
0
        private static void OnCanGrowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            bool           _newValue = (bool)e.NewValue;
            bool           _oldValue = (bool)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsTextBlock)
                {
                    (_context.Child as TextBlock).TextWrapping = _newValue ? TextWrapping.Wrap : TextWrapping.NoWrap;
                    (_context.Child as TextBlock).UpdateLayout();
                }
            }
        }
Esempio n. 9
0
        private static void OnCellFontWeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            FontWeight?    _newValue = (FontWeight?)e.NewValue;
            FontWeight?    _oldValue = (FontWeight?)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsTextBlock)
                {
                    (_context.Child as TextBlock).FontWeight = (FontWeight)_newValue;
                }
                if (_context.IsProgressBar)
                {
                    (_context.Child as DsxCellProgressBar).FontWeight = (FontWeight)_newValue;
                }
            }
        }
Esempio n. 10
0
        private static void OnCellTextAlignmentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d == null || e.NewValue == null)
            {
                return;
            }

            DsxRowCell <T> _context  = (DsxRowCell <T>)d;
            TextAlignment  _newValue = (TextAlignment)e.NewValue;
            TextAlignment  _oldValue = (TextAlignment)e.OldValue;

            if (_newValue != _oldValue)
            {
                if (_context.IsTextBlock)
                {
                    (_context.Child as TextBlock).TextAlignment = _newValue;
                }
                if (_context.IsProgressBar)
                {
                    (_context.Child as DsxCellProgressBar).TextAlignment = _newValue;
                }
            }
        }