Item Height using TextWrap

4 posts, 1 answers
  1. Thomas
    Thomas avatar
    15 posts
    Member since:
    Oct 2012

    Posted 15 May 2014 Link to this post

    Hi,

    I've got a simple listview with a datasource where i want to control the max width each column. However, I got some fields with a lot of text and therefore implemented TextWrap. The text is wraped fine, but the top of and the bottom of the text is cut off(see attached file). It seems that the itemheight needs to be set??? But where and how??

    using 2014.1.226.40
    I'm doing the following:

            public void Initialize()
            {
                this.catalogListView.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
                this.catalogListView.AllowArbitraryItemHeight = true;
                this.catalogListView.GroupDescriptors.Add(new GroupDescriptor(new SortDescriptor[] { new SortDescriptor("type", ListSortDirection.Ascending) }));
                this.catalogListView.EnableGrouping = true;
                this.catalogListView.ShowGroups = true;
                this.catalogListView.DataSource = DataManager.Instance.GetAllFunctions();
            }


            private void Catalog_Load(object sender, EventArgs e)
            {
                foreach (ListViewDetailColumn c in catalogListView.Columns)
                {
                    c.MinWidth = 75;
                    c.MaxWidth = 200;
                    c.AutoSizeMode = ListViewBestFitColumnMode.AllCells;
                    c.BestFit();
                }
            }


            private void catalogListView_CellCreating(object sender, ListViewCellElementCreatingEventArgs e)
            {
                e.CellElement.TextWrap = true;
            }
  2. Answer
    George
    Admin
    George avatar
    500 posts

    Posted 19 May 2014 Link to this post

    Hi Thomas,

    Thank you for contacting us.

    I tried the code you provided me with and it seems to work fine in a sample project. Can you confirm that you are not setting another property which may lead to such behavior? You can see my sample project attached below, take a look and let me know if there is anything that I am missing.

    Looking forward to your response.

    Regards,
    George
    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.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Thomas
    Thomas avatar
    15 posts
    Member since:
    Oct 2012

    Posted 21 May 2014 in reply to George Link to this post

    Hi George,
    Thank you for the reply and the confirmation that the provided code works as expected. However, I was unable to pinpoint the error on my end, but i ended up stripping down listview properties to what I initially provided and building upon that. So far no problems.

    Thanks for your help.
  5. George
    Admin
    George avatar
    500 posts

    Posted 23 May 2014 Link to this post

    Hi Thomas,

    I am glad that you have successfully resolved this matter.

    Do not hesitate to let us know should you have further questions.

    Regards,
    George
    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.
     
Back to Top