I am trying to make URL clickable inside of ListView item.
How do I do this?
The way I want it to work is to user store link in plain text, and then when I am retrieving the links I want to make them clickable in ListView.
This is how I retrieve entries from my database while read.GetString(2) pulls the URL value:
if (security.DecryptAES
(read.GetString(1), storedAuth.Password,
storedAuth.UserName) == "Web Site Password")
{
// Count Web passwords.
countWeb++;
Web = new ListViewItem("");
Web.SubItems.Add(security.DecryptAES
(read.GetString(2), storedAuth.Password, storedAuth.UserName));
Web.SubItems.Add(security.DecryptAES
(read.GetString(5), storedAuth.Password, storedAuth.UserName));
Web.SubItems.Add(security.DecryptAES
(read.GetString(6), storedAuth.Password, storedAuth.UserName));
Web.Tag = read.GetInt32(0);
lvWeb.Items.Add(Web);
}
The first thing you want to do is give visual feedback to let the user know that the item is clickable. I'll just arbitrarily assume the url is in the 2nd column. Add the MouseMove event for the ListView:
The next step is very similar, implement the MouseUp event to detect a click on the sub-item: