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
1540
Row Delete Fade Out Effect
posted

Hello,

I am using an ultragrid on my app. 

If the user double-clicked a row, the row is deleted from the grid. I wanted to show some effects (fade out, for example) before the row dissapear.

It tar possible?

Thanks in advance.

Best regards,

Maria

  • 469350
    Offline posted

    Hi Maria,

    There isn't any built-in functionality for this, but it seems to me that you could implement this yourself by using the Appearance.AlphaLevel for the row, along with a timer.

    I put together a quick sample to demonstrate the technique and I have attached it here. Here's what the code looks like:

    public partial class Form1 : Form
        {
            List<RowAlphaInfo> rowAlpaInfos = new List<RowAlphaInfo>();
            public Form1()
            {
                InitializeComponent();
            }

            private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
            {
                this.rowAlpaInfos.Add(new RowAlphaInfo(e.Row));
                this.StartTimer();

            }

            private void StartTimer()
            {
                if (false == this.timer1.Enabled)
                    this.timer1.Start();
            }

            private void timer1_Tick(object sender, EventArgs e)
            {
                short increment = 15;

                // Copy the rowAlphaInfos into an array. This will allow us to remove items from the
                // List without affecting the foreach iterator.
                RowAlphaInfo[] rowAlphaInfos = this.rowAlpaInfos.ToArray<RowAlphaInfo>();
                foreach (RowAlphaInfo rowAlphaInfo in rowAlphaInfos)
                {
                    UltraGridRow row = rowAlphaInfo.Row;

                    rowAlphaInfo.Alpha -= increment;
                    short alpha = rowAlphaInfo.Alpha;

                    if (alpha > 0)
                    {
                        row.Appearance.AlphaLevel = alpha;
                        row.RowSelectorAppearance.AlphaLevel = alpha;
                    }
                    else
                    {
                        this.rowAlpaInfos.Remove(rowAlphaInfo);
                        row.Delete(false);                    
                    }
                }

                if (this.rowAlpaInfos.Count == 0)
                    this.timer1.Stop();
            }
        }

        public class RowAlphaInfo
        {
            public RowAlphaInfo(UltraGridRow row)
            {
                this.Row = row;
                this.Alpha = 255;
            }

            public UltraGridRow Row { get; set; }
            public short Alpha { get; set; }
        }

    WindowsFormsApplication36.zip