using DevExpress.Xpf.Grid;

namespace BS.Shared.Extensions
{
    public static class GridControlExtensions
    {
        public static T GetCurrentValue<T>(this GridControl pGrid)
        {
            // var lView = pGrid.View;

            // if (lView == null) return default(T);

            // RowData lData = lView.FocusedRowData;

            // if (lData == null || lData.RowHandle == null) return default(T);
            object value = pGrid.GetFocusedRow();
            if (value == null)
            {
                return default(T);
            }

            return (T)value;

            // return (T) pGrid.getr(lData.RowHandle.Value);
        }
    }
}