Exemple #1
0
        internal bool UpdateRowPartLayout(object listItem, ListViewItem listViewItem, bool trackUpdate = true)
        {
            if (listViewItem == null)
            {
                if (this.DataGrid.ItemFixHeight == 0.0 && this.DataGrid.IsVirtualizing)
                {
                    this.DirtyItems.Add(listItem);
                    if (trackUpdate)
                    {
                        this.UpdateLayout();
                    }
                }
                return(false);
            }
            else
            {
                if (!listViewItem.IsLoaded)
                {
                    listViewItem.ApplyTemplate();
                }

                GridViewRowPresenter _gridPresenter = ElementHelper.FindVisualChild <GridViewRowPresenter>(listViewItem);
                UpdateRowArea(_gridPresenter);

                return(true);
            }
        }
Exemple #2
0
        void OnLoaded(object sender, RoutedEventArgs e)
        {
            //  since the element is not a known TemplateChild,
            //  we have to modify after all is loaded

            Thumb _thumb = ElementHelper.FindVisualChild <Thumb>(this, "Thumb");

            if (_thumb != null)
            {
                _thumb.FocusVisualStyle = null;
                //_thumb.Style = sThumbStyle;
            }
        }
Exemple #3
0
        internal void UpdateRowArea(GridViewRowPresenter gridPresenter)
        {
            if (gridPresenter == null)
            {
                //  happens due to virutalization
                return;
            }

            ContentPresenter _cellContent = null;
            FrameworkElement _cellElement = null;

            for (int i = 0; i < gridPresenter.Columns.Count; i++)
            {
                _cellContent = VisualTreeHelper.GetChild(gridPresenter, i) as ContentPresenter;
                _cellElement = ElementHelper.FindVisualChild <FrameworkElement>(_cellContent);
                if (_cellElement != null)
                {
                    _cellElement.InvalidateMeasure();
                    _cellElement.InvalidateArrange();
                    _cellElement.UpdateLayout();
                }
            }
        }
Exemple #4
0
        void OnPreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (this.Column == null)
            {
                return;
            }

            if (this.Column.ViewType == EViewType.CheckBox)
            {
                e.Handled = true;
                return;
            }

            if (this.Column.EditType == EEditType.CellTemplate && this.IsEditMode)
            {
                e.Handled = false;
                return;
            }


            if (this.Column.CellContentIsClickable)
            {
                //   let the click trough on the first button found

                Button _button = ElementHelper.FindVisualChild <Button>(this);

                if (_button != null)
                {
                    Point         _point     = e.GetPosition((UIElement)sender);
                    HitTestResult _hitResult = VisualTreeHelper.HitTest(this, _point);
                    if (_hitResult != null)
                    {
                        Visual _hitElement = ElementHelper.FindVisualChild <Visual>(_button);

                        e.Handled = !(_hitElement == _hitResult.VisualHit);
                    }

                    // this way we could raise the button click event

                    //_button.RaiseEvent( new RoutedEventArgs(Button.ClickEvent));

                    //ButtonAutomationPeer _peerButton = new ButtonAutomationPeer(_button);
                    //IInvokeProvider      _invokeProv = _peerButton.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                    //                     _invokeProv.Invoke();
                }
            }
            else
            {
                e.Handled = true;

                if (this.Column.IsEditable)
                {
                    long _ticksPassed = DateTime.Now.Ticks - m_lastTicks;
                    if (_ticksPassed < 50000000)
                    {
                        m_lastTicks = 0;
                        this.Column.DataGrid.SetEditCell(this.Column, (FrameworkElement)this);
                        return;
                    }
                }
                m_lastTicks = DateTime.Now.Ticks;
            }
        }