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

custom cells come over column header

1 Answer 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ipnordic
Top achievements
Rank 1
ipnordic asked on 16 May 2014, 01:15 PM
Hi ,

I was developed custom cell for web browser and every things work fine but one more problem happened and I can not find solution for it .

The problem was when scrolling , the custom cell come over the the column header , please the picture in attached .

class WebBrowserCellElement : GridDataCellElement
        {
            public WebBrowserCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { }
 
            RadWebBrowserElement radWebBrowserElement;
 
            protected override SizeF ArrangeOverride(SizeF finalSize)
            {
                if (this.Children.Count == 1)
                {
                    RectangleF browserrRect = new RectangleF(5, 5, finalSize.Width - 6, finalSize.Height - 10);
 
                    this.Children[0].Arrange(browserrRect);
                }
              
                return finalSize;
            }
 
            protected override void CreateChildElements()
            {
                base.CreateChildElements();
 
                 radWebBrowserElement = new  RadWebBrowserElement();
 
                this.Children.Add(radWebBrowserElement);
            }
            
 
            protected override void SetContentCore(object value)
            {
                if (this.Value != null && this.Value != DBNull.Value)
                {
                    radWebBrowserElement.DocumentText = this.Value.ToString();
                }
            }
 
             
            protected override Type ThemeEffectiveType
            {
                get
                {
                    return typeof(GridDataCellElement);
                }
            }
 
            public override bool IsCompatible(GridViewColumn data, object context)
            {
                return data is WebBrowserColumn && context is GridDataRowElement;
            }
 
        }
         
        public class WebBrowserColumn : GridViewDataColumn
        {
            public WebBrowserColumn(string fieldName)
                : base(fieldName)
            {
               
            }
 
             
 
            public override Type GetCellType(GridViewRowInfo row)
            {
 
                if (row is GridViewDataRowInfo)
                {
                    return typeof(WebBrowserCellElement);
                }
                return base.GetCellType(row);
            }
        }

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 May 2014, 12:18 PM
Hello Thorben,

Thank you for writing.

In order to avoid such undesired behavior when scrolling, the custom GridDataCellElement should be composed only of RadElements. However, the RadWebBrowserElement contains the Windows Forms WebBrowser control, which hosts Web pages and provides Web browsing capabilities to your application. Using controls in grid cells may slow down the scrolling and will cause visual glitches as they do not support clipping.

A better option would be using custom editors. Please have a look at the referred help article. Another option is to use our HTML-like text formatting. In the provided help article, you can find the list of supported markup tags.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
ipnordic
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or