internal object GetItemAtLocation(Point loc)
        {
            var uie = InputHitTest(loc) as FrameworkElement;

            if (uie != null)
            {
                var rowPresenter = AyTableViewUtils.GetAncestorByType <AyTableViewCellsPresenter>(uie);

                if (rowPresenter != null)
                {
                    return(rowPresenter.Item);
                }
            }

            return(null);
        }
        internal int GetCellIndexAtLocation(Point loc)
        {
            var uie = InputHitTest(loc) as FrameworkElement;

            if (uie != null)
            {
                var rowPresenter = AyTableViewUtils.GetAncestorByType <AyTableViewCellsPresenter>(uie);

                if (rowPresenter != null)
                {
                    var cell = AyTableViewUtils.FindParent <AyTableViewCell>(uie);
                    if (cell != null)
                    {
                        return(rowPresenter.ItemContainerGenerator.IndexFromContainer(cell));
                    }
                }
            }
            return(-1);
        }
Beispiel #3
0
        public void onDragDelta(object sender, DragDeltaEventArgs e)
        {
            var tvch = AyTableViewUtils.GetAncestorByType <AyTableViewColumnHeader>(this);

            if (tvch != null)
            {
                var width = tvch.Width + e.HorizontalChange;
                if (tvch.Column.MinResizeColumnWidth.HasValue && width < tvch.Column.MinResizeColumnWidth)
                {
                    width = tvch.Column.MinResizeColumnWidth.Value;
                }
                if (tvch.Column.MaxResizeColumnWidth.HasValue && width > tvch.Column.MaxResizeColumnWidth)
                {
                    width = tvch.Column.MaxResizeColumnWidth.Value;
                }
                tvch.Column.ParentTableView.IsResizeColumnWidth = true;
                tvch.AdjustWidth(width);
            }
        }