表示ListView控件中的项。
我有以下代码:class Album {私有字符串名称;私人音乐[]音乐; private const int MAX_MUSICS = 100;私有ListViewItem []返回;公共ListViewItem [] ...
当我单击ListView上一行的Button时,我试图存储/获取对象。因此,这是我的代码,用于单击按预期工作的ListView行// Listview ...
[Android ListView onItemClick更改背景颜色时出现索引问题
我遇到问题并陷入困境。当我单击列表视图项时,我想更改背景色。我为此列表视图定制了适配器,我正在控制适配器上的项目点击。但是有索引问题。 ...
具有水平方向的ListView ItemsPanelTemplate,如何识别第一行的ListViewItems?
首先,我正在使用MVVM / WPF / .Net Framework 4.6.1,我有一个ListView,它的水平配置了ItemsPanelTemplate,可显示DataTemplate中的项目。此设置...
[我正在创建一个用于交流学习的Android应用程序,我制作了一个单词列表,它包含一个CheckBoxes和TextView,TextView是显示单词,使用CheckBox来...
如何在条件为Android的情况下更改列表视图项目的背景颜色
我正在创建具有列表视图的应用,并且向列表视图添加了一些值,例如101,102到110。现在,我必须使用edittext更改listview项的背景颜色。例如,如果我输入101,然后...
WPF:使用命令从PreviewMouseLeftButtonDown事件获得ListViewIndex
我想使用以下命令从PreviewMouseLeftButtonDown事件中获取ListViewIndex的索引: [PreviewMouseLeftButtonDown被触发 之前选中了该项目,因此使用EventTrigger的方法将不起作用。 您可以使用MouseLeftButtonDownEvent方法和视图代码背后的AddHandler参数将事件处理程序连接到handledEventsToo: ListViewFiles.AddHandler(ListView.MouseLeftButtonDownEvent, new RoutedEventHandler((ss, ee) => { (DataContext as Window43).ListViewItemMouseLeftButtonDownCommand.Execute(ListViewFiles.SelectedItem); }), true); 就MVVM而言,这并不比在XAML标记中使用EventTrigger差,但是如果您希望能够在多个视图之间共享此功能,则可以创建attached behaviour: public static class MouseLeftButtonDownBehavior { public static ICommand GetCommand(ListView listView) => (ICommand)listView.GetValue(CommandProperty); public static void SetCommand(ListView listView, ICommand value) => listView.SetValue(CommandProperty, value); public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached( "Command", typeof(ICommand), typeof(MouseLeftButtonDownBehavior), new UIPropertyMetadata(null, OnCommandChanged)); private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ListView listView = (ListView)d; ICommand oldCommand = e.OldValue as ICommand; if (oldCommand != null) listView.RemoveHandler(UIElement.MouseLeftButtonDownEvent, (MouseButtonEventHandler)OnMouseLeftButtonDown); ICommand newCommand = e.NewValue as ICommand; if (newCommand != null) listView.AddHandler(UIElement.MouseLeftButtonDownEvent, (MouseButtonEventHandler)OnMouseLeftButtonDown, true); } private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ListView listView = (ListView)sender; ICommand command = GetCommand(listView); if (command != null) command.Execute(listView.SelectedItem); } } XAML: <ListView Name="ListViewFiles" local:MouseLeftButtonDownBehavior.Command="{Binding ListViewItemMouseLeftButtonDownCommand}" />
我花了很多时间来尝试创建带有可点击项的ListView,以启动新活动以及打开浏览器页面的URL链接。应为以下项目:一些文本[URL在这里]通过...
在C#中关闭对话框时如何清除ItemListView.SelectedItems?
我一直在使用ListViewItem作为列表对话框。我目前的问题是当我关闭对话框时,我的SelectedItem不会返回null或为空。对于参考图像,...
我有一个ListView(将移至RecyclerView),其ListView Item XML布局在LinearLayout中包含3个TextView。我的用户首选项允许左撇子或右撇子使用。其中...
ListView总是从CustomAdaptor中删除最后一行
我的ListView在每行上包含更多按钮,它将弹出带有删除选项的列表。当我单击删除选项时,它会删除最后一个项目。在CustomAdaptor中,我尝试了notifyDataSetChanged()...
我试图创建3个文本行WPF列表视图,但右边框设置不正确(由围绕1-3像素右边框切断。左手边是罚款。
C#ObjectListView - 手动设置SelectedObject
这种代码不会在ObjectListView设置SelectedObject:整数ID = 1; //独特的foreach(对象o在ObjectListViewInstance.Objects){如果(o.ID == ID){this.ObjectListViewInstance ....
当我的ListViewItem被突出,我希望文本变成白色。我该如何定义呢?
将列表中的项目添加到其中后,我的列表视图不显示任何内容。为什么?我的列表不是空的我的程序进入这个循环。那么将项目添加到列表视图中的代码是错误的吗?因为我看到......
我的应用程序中有一个列表视图。每行都有一些按钮,只影响同一行。我不想刷新整个Listview。当我在点击按钮上调用setState()时,会导致整个......
我在WinForms应用程序上有一个listview控件。在这里,点击单独的按钮,我确实改变了几个listview项目backcolor并重新加载整个网格,因为有一些变化...
UWP - MVVM - 使用ItemTemplate按钮删除ListView项
我有一个显示项目列表的屏幕,用户可以在其中单击按钮从列表中删除相应的项目。我试图使用MVVM这样做。但该项目并不知道......
我希望在用户按住并按下左按钮然后在半秒后释放后长时间保持ListViewItem。这是我到目前为止尝试的,我设法赶上第一次点击:
我有一个列表视图,其中我有几个listviewitems,但我想显示其他信息,因此我添加了一个扩展器,在所述listviewitem中显示另一个列表视图。但我的问题是......