Hello,
you could try something like the following, using a background worker and updating the scroll via the progress changed event
Designer File
namespace
RadListControl_LargsItems_CS
{
partial
class
Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private
System.ComponentModel.IContainer components;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected
override
void
Dispose(
bool
disposing)
{
if
(disposing && (components !=
null
))
{
components.Dispose();
}
base
.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent()
{
this
.radListControl1 =
new
Telerik.WinControls.UI.RadListControl();
this
.backgroundWorker1 =
new
System.ComponentModel.BackgroundWorker();
this
.radButtonTest =
new
Telerik.WinControls.UI.RadButton();
this
.radButtonStop =
new
Telerik.WinControls.UI.RadButton();
((System.ComponentModel.ISupportInitialize)(
this
.radListControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(
this
.radButtonTest)).BeginInit();
((System.ComponentModel.ISupportInitialize)(
this
.radButtonStop)).BeginInit();
this
.SuspendLayout();
//
// radListControl1
//
this
.radListControl1.CaseSensitiveSort =
true
;
this
.radListControl1.Dock = System.Windows.Forms.DockStyle.Left;
this
.radListControl1.Location =
new
System.Drawing.Point(0, 0);
this
.radListControl1.Name =
"radListControl1"
;
this
.radListControl1.Size =
new
System.Drawing.Size(236, 262);
this
.radListControl1.TabIndex = 0;
this
.radListControl1.Text =
"radListControl1"
;
//
// backgroundWorker1
//
this
.backgroundWorker1.WorkerReportsProgress =
true
;
this
.backgroundWorker1.DoWork +=
new
System.ComponentModel.DoWorkEventHandler(
this
.backgroundWorker1_DoWork);
this
.backgroundWorker1.ProgressChanged +=
new
System.ComponentModel.ProgressChangedEventHandler(
this
.backgroundWorker1_ProgressChanged);
//
// radButtonTest
//
this
.radButtonTest.Location =
new
System.Drawing.Point(252, 30);
this
.radButtonTest.Name =
"radButtonTest"
;
this
.radButtonTest.Size =
new
System.Drawing.Size(102, 24);
this
.radButtonTest.TabIndex = 1;
this
.radButtonTest.Text =
"Show Message"
;
this
.radButtonTest.Click +=
new
System.EventHandler(
this
.radButtonTest_Click);
//
// radButtonStop
//
this
.radButtonStop.Location =
new
System.Drawing.Point(252, 226);
this
.radButtonStop.Name =
"radButtonStop"
;
this
.radButtonStop.Size =
new
System.Drawing.Size(102, 24);
this
.radButtonStop.TabIndex = 2;
this
.radButtonStop.Text =
"Stop"
;
this
.radButtonStop.Click +=
new
System.EventHandler(
this
.radButtonStop_Click);
//
// Form1
//
this
.AutoScaleDimensions =
new
System.Drawing.SizeF(6F, 13F);
this
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this
.ClientSize =
new
System.Drawing.Size(366, 262);
this
.Controls.Add(
this
.radButtonStop);
this
.Controls.Add(
this
.radButtonTest);
this
.Controls.Add(
this
.radListControl1);
this
.Name =
"Form1"
;
this
.Text =
"Form1"
;
this
.FormClosing +=
new
System.Windows.Forms.FormClosingEventHandler(
this
.Form1_FormClosing);
this
.Load +=
new
System.EventHandler(
this
.Form1_Load);
((System.ComponentModel.ISupportInitialize)(
this
.radListControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(
this
.radButtonTest)).EndInit();
((System.ComponentModel.ISupportInitialize)(
this
.radButtonStop)).EndInit();
this
.ResumeLayout(
false
);
}
#endregion
private
Telerik.WinControls.UI.RadListControl radListControl1;
private
System.ComponentModel.BackgroundWorker backgroundWorker1;
private
Telerik.WinControls.UI.RadButton radButtonTest;
private
Telerik.WinControls.UI.RadButton radButtonStop;
}
}
Form1.cs
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
namespace
RadListControl_LargsItems_CS
{
public
partial
class
Form1 : Form
{
private
Boolean m_Continue =
true
;
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
this
.radListControl1.SelectionMode = SelectionMode.One;
this
.backgroundWorker1.RunWorkerAsync();
}
private
void
backgroundWorker1_DoWork(
object
sender, DoWorkEventArgs e)
{
while
(m_Continue ==
true
)
{
radListControl1.Items.Add(DateTime.Now.ToString());
if
(radListControl1.Items.Count > 100)
{
radListControl1.Items.RemoveAt(0);
}
this
.backgroundWorker1.ReportProgress(0, radListControl1.Items.Count - 1);
System.Threading.Thread.Sleep(1000);
}
}
private
void
backgroundWorker1_ProgressChanged(
object
sender, ProgressChangedEventArgs e)
{
if
(m_Continue)
{ radListControl1.ScrollToItem(radListControl1.Items[Convert.ToInt32(e.UserState)]);}
}
private
void
radButtonTest_Click(
object
sender, EventArgs e)
{
MessageBox.Show(
"UI Still Responding"
);
}
private
void
radButtonStop_Click(
object
sender, EventArgs e)
{
m_Continue =
false
;
}
private
void
Form1_FormClosing(
object
sender, FormClosingEventArgs e)
{
m_Continue =
false
;
}
}
}
Let me know how that goes
Richard