ChocoPM.Extensions.DataGridExtensions.GetSortMemberPath C# (CSharp) Method

GetSortMemberPath() public static method

public static GetSortMemberPath ( this column ) : string
column this
return string
        public static string GetSortMemberPath(this DataGridColumn column)
        {
            // find the sortmemberpath
            string sortPropertyName;

            var boundColumn = column as DataGridBoundColumn;
            if (boundColumn == null)
            {
                return null;
            }

            var binding = boundColumn.Binding as Binding;
            if (binding == null)
            {
                return null;
            }

            if (!string.IsNullOrEmpty(binding.XPath))
            {
                sortPropertyName = binding.XPath;
            }
            else if (binding.Path != null)
            {
                sortPropertyName = binding.Path.Path;
            }
            else
                sortPropertyName = null;

            return sortPropertyName;
        }