listviewitem

Cast ListView Items to List<string>?

只谈情不闲聊 提交于 2019-12-21 03:46:19
问题 How can I cast ListView.Items to a List<string> ? This is what I tried: List<string> list = lvFiles.Items.Cast<string>().ToList(); but I received this error: Unable to cast object of type 'System.Windows.Forms.ListViewItem' to type 'System.String'. 回答1: A ListViewItemCollection is exactly what it sounds like - a collection of ListViewItem elements. It's not a collection of strings. Your code fails at execution time for the same reason that this code would fail at compile time: ListViewItem

Determining which ListViewItem was clicked on in a ListView when executing a ContextMenu MenuItem

女生的网名这么多〃 提交于 2019-12-21 02:41:30
问题 I'm trying to use the context menu in a listview to run some code that requires data from which item it originated from. I initially just did this: XAML: <ListView x:Name="lvResources" ScrollViewer.VerticalScrollBarVisibility="Visible"> <ListView.Resources> <ContextMenu x:Key="resourceContextMenu"> <MenuItem Header="Get Metadata" Name="cmMetadata" Click="cmMetadata_Click" /> </ContextMenu> </ListView.Resources> <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter

How to highlight ListView-Items

我与影子孤独终老i 提交于 2019-12-20 19:39:29
问题 i got the following problem. i have a ListView with custom rows consisting of an imageview and a textview. the textview's xml code is <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="26px" android:layout_marginLeft="3px" android:singleLine="true" android:ellipsize="end" android:textColorHighlight="#FEC403" /> then i have an itemclicklistener that works fine

How do i use the OnItemClickListener to start a new intent based on which item is clicked?

孤人 提交于 2019-12-20 01:48:06
问题 I want to be able to start a new activity using the Intent class. I know how to start an activity by using these lines of code: Intent myIntent = new Intent(v.getContext(), bylocationactivity.class); startActivityForResult(myIntent, 0); But how do i specify which item has been clicked? So when I click "By Location" I can start the bylocationactivity.class and so on? public class bonesactivity extends Activity { public void onCreate(Bundle savedInstanceState) { ListView boneslist; String

WPF ListView Highlight Color don't change

穿精又带淫゛_ 提交于 2019-12-19 10:56:11
问题 I have a ListView with three TextBlock for each Item. The first one has the default color (black) and the others has the property Foreground set to gray. When I select an item the color of the first TextBlock becomes blue but the others stay gray and are hard to read. I want that all the text become white color when the item is selected. How I do that ? Edit : My style : <UserControl.Resources> <Style TargetType="{x:Type ListViewItem}"> <Style.Triggers> <Trigger Property="IsSelected" Value=

Android ListView item highlight programmatically

若如初见. 提交于 2019-12-19 06:54:06
问题 I know it's been asked around but I haven't found quite the answer yet (new to Android so sorry about the ignorance) my app's launch Activity has an EditText (called searchbox) , a ListView (designations) and a Spinner (types) I use the EditText as a searchbox, I have to pass the string through a custom editing to make searching more flexible. After that I match that against the closest approximation I find in 'designations' and do designations.setSelection(j); As expected, this sets the

How to add subitems to a ListView?

匆匆过客 提交于 2019-12-19 03:12:38
问题 I'm trying to get the simplest possible example of a Listview with subitems working. But this code: private void button1_Click(object sender, EventArgs e) { listView1.Groups.Add(new ListViewGroup("Kannst du mich sehen?", HorizontalAlignment.Left)); string[] strArr = new string[4] { "uno", "dos", "twa", "quad" }; for (int i = 0; i < strArr.Length; i++) { ListViewItem lvi = new ListViewItem(strArr[i]); listView1.Items.Add(lvi); lvi.SubItems.Add("Ciao, Baby!"); listView1.Items[i].Group =

How to add subitems to a ListView?

一个人想着一个人 提交于 2019-12-19 03:12:09
问题 I'm trying to get the simplest possible example of a Listview with subitems working. But this code: private void button1_Click(object sender, EventArgs e) { listView1.Groups.Add(new ListViewGroup("Kannst du mich sehen?", HorizontalAlignment.Left)); string[] strArr = new string[4] { "uno", "dos", "twa", "quad" }; for (int i = 0; i < strArr.Length; i++) { ListViewItem lvi = new ListViewItem(strArr[i]); listView1.Items.Add(lvi); lvi.SubItems.Add("Ciao, Baby!"); listView1.Items[i].Group =

How to set tooltip for a ListviewSubItem

眉间皱痕 提交于 2019-12-18 08:11:28
问题 I have a ListView control in Details view as that (the view that shows the list as a grid) mListView.View = View.Details; mListView.mLVSelectedObject.ShowItemToolTips = true; ListViewItem listViewItem = mListView.Items.Add(lValue.Name); listViewItem.ToolTipText = "AAAAAAAAAAAAAAAAA"; The issue is that the tooltip only shows up when the cursors is over the first listview's column but not for the rest o them. I want to know if there's anyway to make it appear "easly" ? 回答1: After some research.

android listview viewholder. when to use it, and when not to

∥☆過路亽.° 提交于 2019-12-18 07:46:11
问题 I have a ListView with a custom list adapter. In the getView() method, am using the ViewHolder 'pattern' as shown in the API Demos for ListView14.java. When i first render the list it seems to load correctly. However, the issue i'm running into is that when i scroll the list, i'm seeing the data for the list show up in the wrong rows (i.e. a TextView that should be in row 10 is showing up in row 2 for example). However, when I do not use the viewholder, and instead call findViewById() every