Problem with ListView Selection First Time

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
 
P

Peter Kellner

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top