Example #1
0
        private Tuple <Point, Size> GetSelected()
        {
            if (_selectionCell == null || _selectionListBox == null)
            {
                return(null);
            }

            var selected = (ListBoxItem)_selectionListBox.GetItemVisual(_selectionListBox.SelectedItem);

            return(selected == null ? null : Tuple.Create(selected.TransformToAncestor(_selectionCell).Transform(new Point(0, 0)),
                                                          new Size(selected.ActualWidth / Math.Max(_selectionCell.ActualWidth, 1d), selected.ActualHeight / Math.Max(_selectionCell.ActualHeight, 1d))));
        }