This is a migrated thread and some comments may be shown as answers.

Pinned transparent columns collateral effect

2 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emanuele Savarese
Top achievements
Rank 1
Emanuele Savarese asked on 13 Jan 2008, 09:55 PM
WinForms RadControls Q3 2007
Visual Studio 2005
.NET 2.0

I want two columns pinned and I set IsPinned property to true.
When I scrolling grid content of other columns slide under pinned colums.
I tried to create a new Theme and set backcolor of GridRowElement (root/element) with Telerik Visual Style Builder but I nothing changed.

I created a conditional formatting to force backcolor to white, but in this way I lose borders of row selection.

Any better idea?
Thanks in advance,
Emanuele Savarese

This is code to reproduce error. Uncomment rows to view my solution with conditional formatting.
        private void Form1_Load(object sender, EventArgs e) 
        { 
            DataTable dt = new DataTable(); 
            dt.Columns.Add("From", typeof(bool)); 
            dt.Columns.Add("To", typeof(bool)); 
            dt.Columns.Add("Description", typeof(string)); 
 
            dt.Rows.Add(false, false, "hi1"); 
            dt.Rows.Add(false, false, "hi2"); 
            dt.Rows.Add(false, false, "hi3"); 
            dt.Rows.Add(false, false, "hi4"); 
            dt.Rows.Add(false, false, "hi5"); 
            dt.Rows.Add(false, false, "hi5"); 
            dt.Rows.Add(false, false, "hi6"); 
 
            radGridView1.MasterGridViewTemplate.AutoGenerateColumns = false
            radGridView1.Columns.Add(new GridViewBooleanColumn("From")); 
            radGridView1.Columns[0].IsPinned = true
            radGridView1.Columns.Add(new GridViewBooleanColumn("To")); 
            radGridView1.Columns[1].IsPinned = true
            radGridView1.Columns.Add(new GridViewTextBoxColumn("Description")); 
            radGridView1.Columns[2].ReadOnly = true
            radGridView1.Columns[2].Width = 1000
 
            //ConditionalFormattingObject item = new ConditionalFormattingObject("ruleName", 
            //    ConditionTypes.LessOrEqual, "aa", string.Empty, true); 
            //item.CellBackColor = Color.White; 
            //item.RowBackColor = Color.White; 
            //radGridView1.Columns[0].ConditionalFormattingObjectList.Add(item); 
 
            //item = new ConditionalFormattingObject("ruleName", 
            //    ConditionTypes.LessOrEqual, "aa", string.Empty, true); 
            //item.CellBackColor = Color.White; 
            //item.RowBackColor = Color.White; 
            //radGridView1.Columns[1].ConditionalFormattingObjectList.Add(item); 
 
            radGridView1.SelectionMode = GridViewSelectionMode.FullRowSelect; 
            radGridView1.DataSource = dt
        } 



2 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 14 Jan 2008, 11:45 AM
Hi Emanuele Savarese,

Thank you for writing.

Unfortunately, this is an issue that exists in Q3 2007. We will correct the themes in our upcoming release. In order to enable drawing the fill of a cell you must set the DrawFill property to true.

The following code snippet shows a workaround for this issue:

void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.IsPinned) 
    { 
        if (e.CellElement.RowInfo.IsCurrent) 
        { 
            e.CellElement.BackColor = Color.FromArgb(206,243,255); 
            e.CellElement.BorderBottomColor = Color.FromArgb(156,223,255); 
            e.CellElement.BorderTopColor = Color.FromArgb(156, 223, 255); 
            e.CellElement.BorderLeftWidth = 0; 
            e.CellElement.BorderRightWidth = 0; 
            e.CellElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders; 
            e.CellElement.DrawBorder = true
        } 
        else 
        { 
            e.CellElement.BackColor = Color.White; 
            e.CellElement.DrawBorder = false
        } 
        e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid; 
        e.CellElement.DrawFill = true
        e.CellElement.ZIndex = 20000; 
    } 
    else 
    { 
        e.CellElement.DrawFill = false
        e.CellElement.DrawBorder = false
        e.CellElement.ZIndex = 1; 
    } 

We hope this solves your issue. In case you need further assistance, do not hesitate to contact us.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Emanuele Savarese
Top achievements
Rank 1
answered on 14 Jan 2008, 01:22 PM
Thanks a lot!

It's work fine,
Emanuele Savarese
Tags
GridView
Asked by
Emanuele Savarese
Top achievements
Rank 1
Answers by
Jack
Telerik team
Emanuele Savarese
Top achievements
Rank 1
Share this question
or