Forum  Commercial Foru...  Commercial Foru...  ListView and text wrapping
Previous Previous
 
Next Next
New Post 6/13/2012 11:03 AM
  sramirez@dynacal.com
508 posts
1st Level Poster


ListView and text wrapping 

Is it possible to have text wrapping on a listview column?  If so, how would I go about doing this?

Thanks,

Shawn

 
New Post 6/13/2012 4:39 PM
  palli
14324 posts
1st Level Poster




Re: ListView and text wrapping 

 Hi Shawn,

The standard ListView column does not wrap its text. 

You can make it work with some programming though, and what quickly comes to mind are two approaches, both having in common to use Control type column, but for different purposes.

Method 1: 

Use a dummy invisible control type column and set its PreferedHeight according to your logic, which will force the height of the ListView item to be of that height as a minimun, and then use your own function to wrap the text and add linebreaks.

Method 2:

Use a control type column with a TextBox contained in it, which should wrap the text for you.

For Method 1, I generated the following test code:

 

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            this.listView1.DataSource = BuildDataTable();
            ColumnHeader ch = new ColumnHeader();
            ch.Type = ListViewColumnType.Control;
            ch.PreferedItemHeight = 70;
            ch.Visible = false;
            this.listView1.Columns.Add(ch);
 
        }
 
        private DataTable BuildDataTable()
        {
            DataTable DT = new DataTable();
            DT.Columns.Add("Col1");
            DT.Columns.Add("Col2");
            DT.Columns.Add("Col3");
 
            for (int i = 0; i < 5; i++)
                DT.Rows.Add(i.ToString(), RandomString(i, true), RandomString(i, false));
            return DT;
        }
 
        private string RandomString(int i, bool blnAddNewLine)
        {
            string s = string.Empty;
            for (int j = 0; j <= i; j++)
                s += "somewords" + (blnAddNewLine ? Environment.NewLine : " ");
            return s;
        }
 
    }

 

Hope thsi helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 8/20/2012 9:37 AM
  SplitMerge
95 posts
www.hrtms.com
No Ranking


Re: ListView and text wrapping 

Palli (and VWG Team)

We have been porting our application to 6.4 and noticed some interesting issues with text wrapping

This picture shows the behavior - Safari vs. IE vs. FF

http://screencast.com/t/kIpqpKNKO

This next image shows FF - it has a wide row

http://screencast.com/t/gfWQoUwu

So we are using the 6.4 e version (more on that later). The IE listview renders like it did in 6.3 with a single row only. Safari and FF show a wide row matching the text height.

Is there a setting to get IE to also grow with the size of the text?

 

Now, we had started this conversion process using the NetHtml5 version (preview I guess). Under this version, the IE listview rows also show like FF and Safari, so there is a big difference for IE depending on the build of 6.4 you use.

Can you give us some guidance on this?

 

Thanks

Mitch Stephens

HRTMS

 

 

 
New Post 8/21/2012 12:26 PM
  ori.cohen
4401 posts
1st Level Poster




Re: ListView and text wrapping 

Hello Mr. Stephens,

Thank you for these reports.
Please reply to tell me what version of Visual WebGui you are porting from, to v6.4.0.

Please also create a minimal sample reproducing application and send it to Ori [dot] Cohen [at] Gizmox [dot] com, with a link to this forum thread.
I will promptly attempt to reproduce on the current state of v6.4 Release f and .NETHTML5 Preview3.
I will then reply in this thread here with te results.

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
New Post 8/22/2012 8:21 AM
  SplitMerge
95 posts
www.hrtms.com
No Ranking


Re: ListView and text wrapping 

Ori,

I sent you the sample program, and here is a screencast of the actual issue.  We migrated from 6.3, but this issue appears with a new program in 6.4 XSLT build version e.

If you run the application, you will see this behavior with different browsers:

http://screencast.com/t/HNO06M2Ie

For the record, i would prefer the IE listview grow to show multi-line text values like the other browsers show

Mitch

 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  ListView and text wrapping
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS