protected void columnHeader_Click(object sender, RoutedEventArgs e)
        {
            var columnHeader = sender as DataGridColumnHeader;

            if (columnHeader != null &&
                !(columnHeader.Column is DeleteRowColumn) &&
                !(columnHeader.Column is EditRowColumn))
            {
                var sortMember = columnHeader.Column.SortMemberPath;
                if (sortMember != null)
                {
                    if (DynamicGridViewModel.GridRecords.Any())
                    {
                        //due to the heavy xaml structure for the view model views
                        //they sometimes take an eternity to sort
                        //especially if lookup, and multiselect fields and heap of rows
                        //so do this hack to display loading while it sorts
                        //the row load event in the view will decrease the sort count until loaded
                        //could not use bindings for this as they were not processing into the ui thread in correct sequence
                        //so have just hacked this way in code behind which seems to take immediate effect
                        SortingLoadGrid.Visibility = Visibility.Visible;
                        SortingMainGrid.Visibility = Visibility.Hidden;
                        DynamicGridViewModel.SortIt(sortMember.Trim(new[] { '[', ']' }));
                    }
                }
            }
        }
        protected void columnHeader_Click(object sender, RoutedEventArgs e)
        {
            var columnHeader = sender as DataGridColumnHeader;

            if (columnHeader != null &&
                !(columnHeader.Column is DeleteRowColumn) &&
                !(columnHeader.Column is EditRowColumn))
            {
                var sortMember = columnHeader.Column.SortMemberPath;
                if (sortMember != null)
                {
                    DynamicGridViewModel.SortIt(sortMember.Trim(new[] { '[', ']' }));
                }
            }
        }