Example #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;
                }
            }
        }
Example #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;
                }
            }
        }
Example #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;
            }
        }
Example #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);
            }
        }
Example #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;
            }
        }
Example #6
0
        internal void ToggleCheck(DsxCellBase curCell)
        {
            DsxRowCell <CheckBox> _checkCell = curCell as DsxRowCell <CheckBox>;

            if (_checkCell != null)
            {
                bool _newValue = (bool)_checkCell.IsChecked;
                _newValue = !_newValue;

                System.Diagnostics.Debug.WriteLine("ToggleCheck {0}", _newValue);

                _checkCell.Dispatcher.BeginInvoke(new Action(delegate
                {
                    _checkCell.IsChecked = _newValue;
                }),
                                                  DispatcherPriority.Input);
            }
        }
Example #7
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;
                }
            }
        }
Example #8
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;
                }
            }
        }
Example #9
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();
                }
            }
        }
Example #10
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;
                }
            }
        }
Example #11
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;
                }
            }
        }