예제 #1
0
        /// <summary>
        /// returns: if succeeded (if was able to initialize it)
        /// </summary>
        private bool InitializeRowHeightIfNeededAndPossible()
        {
            if (HasRowHeightPx && HasColumnsHeights || !_model.Items.Any() || !_view.IsAttached() || !_view.GetHeaderRowHeight().HasValue)
            {
                return(false);
            }

            Logger.Debug(GetType(), "Needs and is able to calculate datagrid's row height and fact column widths");
            var needsProto = _visRows.GetVisibleCount() <= 0;

            if (needsProto)
            {
                AppendRowFor(_model.Items.First());
            }

            InitializeColumnWidths();

            if (needsProto)
            {
                DestroyRowAt(0);
            }

            return(true);
        }