I have a RADListControl which requires scrolling in order to see all the items. After the control is Initialized, I populate it and set the initial selection. If that selection is beyond the initial visible range of the list, it is selected, but the list is not scrolled to make it visible. (e.g., if I set SelectedIndex of the control with a list of 100 items to 50, item 50 is selected after the initial draw, but only items 0 through 20 are shown if the control is only tall enough to show 20 items.)
Subsequent changes to the SelectedINdex work as expected - i.e., if I change the selection no an item that id beyond the current visible range of the list, then the list will scroll enough to make it visible.
Is there a way to cause the initial selection to be displayed? Sample code below.
namespace ListBoxScrollTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 101; i++)
{
radListControl1.Items.Add(i.ToString());
}
numericUpDown1.Minimum = 0;
numericUpDown1.Maximum = listBox1.Items.Count - 1;
numericUpDown1.Value = (int)(listBox1.Items.Count/2);
int init = (int)(numericUpDown1.Value);
radListControl1.SelectedIndex = init;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
int val = (int)(numericUpDown1.Value);
radListControl1.SelectedIndex = val;
}
}
}
Subsequent changes to the SelectedINdex work as expected - i.e., if I change the selection no an item that id beyond the current visible range of the list, then the list will scroll enough to make it visible.
Is there a way to cause the initial selection to be displayed? Sample code below.
namespace ListBoxScrollTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 101; i++)
{
radListControl1.Items.Add(i.ToString());
}
numericUpDown1.Minimum = 0;
numericUpDown1.Maximum = listBox1.Items.Count - 1;
numericUpDown1.Value = (int)(listBox1.Items.Count/2);
int init = (int)(numericUpDown1.Value);
radListControl1.SelectedIndex = init;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
int val = (int)(numericUpDown1.Value);
radListControl1.SelectedIndex = val;
}
}
}