catamount

Hi Experts,

I have a ListView (detail mode) and I want to select some related items when an item is cliked.

The environment is Visual Studio C# 2005.

How can I implement it

I tried: In the Click event handler, I set some items to selected state.

But when sometimes, these selected items will be unselected automatically.

Thanks.



Re: Smart Devices VB and C# Projects How to selected related items in ListView(C#) when an item is click?

Zero Dai - MSFT

Hi catamount,

I guess you use ListViewItem.Selected to set an item selected. Surely, It cannot work, since every time you set it to true, ListViewItem.SelectIndexChanged will be called. And also, MultiSelect is not supported in .NET Compact Framework.

The solution is, if your application will be running on Pocket PC. Luckily, you can use CheckBox property of it. After selecting the item, check the related items.

Thanks,

Zero Dai - MSFT






Re: Smart Devices VB and C# Projects How to selected related items in ListView(C#) when an item is click?

Zero Dai - MSFT

Move to Smart Device VB and C# project forum.

Thanks!






Re: Smart Devices VB and C# Projects How to selected related items in ListView(C#) when an item is click?

catamount

Thanks Zero Dai,

I tried to set some items selected using ListViewItem.Selected property to set some items selected when an item is clicked.

But it doesn't work.

I can hardly tell my manager that I can not implement this simple function with the powerful .Net framework.

Is there a possilbe way to do so

Thanks a lot in advance.

Catamount





Re: Smart Devices VB and C# Projects How to selected related items in ListView(C#) when an item is click?

Zero Dai - MSFT

Hi Catamount,

Sorry, but it's .NET Compact Framework. Some limitations cause it is not able to do what desktop version can. Searching in the forum with the similar topic, I think it's best choice to use checkbox property instead of selected, with which you can achieve the same functionality.

Or, you can also keep all the items that you want to set it selected in a Array.

Hope this can help,

Zero Dai - MSFT






Re: Smart Devices VB and C# Projects How to selected related items in ListView(C#) when an item is click?

catamount

Thank you so much, Zero Dai.