Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3550
Automatically adjust row height to text on card view
posted

I want to use card view.

I want row height to adjust automatically to text.

How can this be done?

This is my code but row height does not adjust. but stay fixed.

I use v8.1 with .net2


using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 

using Infragistics.Win; 

namespace WindowsApplication2 
{ 
    public partial class Form1 : Form 
    { 
        public Form1() 
        { 
            InitializeComponent(); 
        } 

        private void button1_Click(object sender, EventArgs e) 
        { 

            List<Person> ls = new List<Person>(); 
            ls.Add(new Person("x""y" + Environment.NewLine + "z")); 
            ls.Add(new Person("1""2")); 

            ultraGrid1.DataSource = ls; 
            ultraGrid1.DisplayLayout.Bands[0].Columns["Value"].PerformAutoResize(); 
        } 

        private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) 
        { 
            e.Layout.Bands[0].CardView = true; 

            e.Layout.Bands[0].Columns["Value"].CellMultiLine = DefaultableBoolean.True; 
            //e.Layout.Bands[0].Columns["DESCRIPTION"].CellMultiLine = DefaultableBoolean.True; 

            e.Layout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree; 
      
        
            e.Layout.Bands[0].CardSettings.AutoFit = true; 
      
        } 
    } 
    public class Person { 
        private string mName; 
        private string mValue; 
        public Person(string name, string value) 
        { 
            Name = name; 
            Value = value; 
        } 

        public string Name 
        { 
            get { return mName; } 
            set { mName = value; } 
        } 
        public string Value 
        { 
            get { return mValue; } 
            set { mValue = value; } 
        } 
        
    
        
    } 
}

Parents Reply Children