Problem with ListView Selection First Time

  • Thread starter Thread starter Peter Kellner
  • Start date Start date
P

Peter Kellner

When I create a very simple listview (as the only control in the
smartphone app) the down button the the pad doesn't move the cursor down
until the second press. After that it works fine. When I add keypress
and keydown events they all fire. I just don't understand why the
selected item stays put until I press it twice. (again, just on the
first time). Here is the simplest code I can think of that demonstrates
this problem.

private void Formtest_Load(object sender, EventArgs e)
{
ListViewItem lvi1 = new ListViewItem("listitem1");
ListViewItem lvi2 = new ListViewItem("listitem2");
ListViewItem lvi3 = new ListViewItem("listitem3");

listView1.Items.Add(lvi1);
listView1.Items.Add(lvi2);
listView1.Items.Add(lvi3);

listView1.Items[0].Selected = true;
}

Thanks for any help on this
 
This followup was posted to
microsoft.public.dotnet.framework.compactframework

Try a listView1.Focus()

Cheers
Daniel
--

Great hint. Almost worked. Made me think to try this:

listView1.Items[0].Focused = true;

which did work.

Thanks
 
Back
Top