Completed
Last Updated: 05 Jun 2014 07:08 by ADMIN
ADMIN
Nikolay
Created on: 11 Dec 2012 05:21
Category: GridView
Type: Bug Report
0
FIX. Setting RightToLeft to specific CellElements in CellFormatting lead to an unexpected result
Let's have a RadGridView that is RightToLeft.Yes with at least three columns. In the CellFormatting event set RightToLeft.No to the CellElements that belong to the middle column. Now start dragging the last column (first in RightToLeft.Yes) so that it becomes bigger and its size goes beyond what RadGridView gives as available estate area. You will notice that the CellElements that are RightToLeft.No go in the opposite direction.

Resolution: Currently, the correct way to achieve a grid with RightToLeft.Yes while some of its cells are RightToLeft.No is to use a custom column with custom cells:

 public class MyGridViewDecimalColumn : GridViewDecimalColumn
    {
        public MyGridViewDecimalColumn()
            : base()
        {

        }

        public MyGridViewDecimalColumn(string fieldName)
            : base(fieldName)
        {
        }

        public MyGridViewDecimalColumn(string fieldName, string uniqueName)
            : base(uniqueName, fieldName)
        {
        }

        public override Type GetCellType(GridViewRowInfo row)
        {
            if (row is GridViewDataRowInfo)
            {
                return typeof(MyGridDecimalCellElement);
            }

            return base.GetCellType(row);
        }
    }

    public class MyGridDecimalCellElement : GridDataCellElement
    {
        public MyGridDecimalCellElement(GridViewColumn col, GridRowElement row)
            : base(col, row)
        {

        }

        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(GridDataCellElement);
            }
        }

        protected override Telerik.WinControls.Primitives.TextParams CreateTextParams()
        {
            Telerik.WinControls.Primitives.TextParams parameters = base.CreateTextParams();
            parameters.rightToLeft = false;
            return parameters;
        }

        public override bool IsCompatible(GridViewColumn data, object context)
        {
            return base.IsCompatible(data, context) && data is GridViewDecimalColumn;
        }
    }
0 comments