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

Item Height using TextWrap

3 Answers 144 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 15 May 2014, 07:15 AM
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;
        }

3 Answers, 1 is accepted

Sort by
0
Accepted
George
Telerik team
answered on 19 May 2014, 12:10 PM
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.
 
0
Thomas
Top achievements
Rank 1
answered on 21 May 2014, 10:41 AM
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.
0
George
Telerik team
answered on 23 May 2014, 02:04 PM
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.
 
Tags
ListView
Asked by
Thomas
Top achievements
Rank 1
Answers by
George
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or