listview 相关问题

ListView是UI库在大多数现代操作系统中提供的图形屏幕控件或窗口小部件,用于以列表形式显示项目。

ListView Header 和 ItemTemplate 不能左对齐

ListViews Header 和 ItemTemplate 具有相同的列宽,但 * 列之后的标题右对齐: 标题(黄色 BG)显示列宽,* 70 15 & 70 * 对齐 ...

回答 1 投票 0

水平对齐项目 ListView.builder - Flutter

我有这个代码: 未来建设者( 未来:_data, 构建器:(上下文,AsyncSnapshot 快照){ 如果 (!snapshot.hasData) { 返回常量中心(子:CustomLoadingAnimation()); ...

回答 2 投票 0

使用 Flutter 模型和动态 api 响应

大家好,我是 flutter 的新手 我通过在线工具为我的历史生成了一个模型类

回答 0 投票 0

如何在android中的自定义对话框中添加单选列表?

我想在自定义对话框中添加一个选择列表我已经在不同类型中尝试过,但我的应用程序仅因空指针错误而崩溃。我发现它只能在 AlertDialog 中完成。

回答 3 投票 0

flutter:强制 listview.builder 填充所有可用空间

我试图强制 listview.builder 填充屏幕中的所有可用空间(使可滚动到所有可用空间) 我的代码: 柱子( 孩子们:[ 小工具...

回答 2 投票 0

用户界面没有正确更新

在此我制作了一个包含数据的列表并将其提供给listview.builder 我的问题是当我想用 _removeFromList 删除第二张地图时 它从列表中删除,但 listview.builder

回答 0 投票 0

在 ListView vb.net 中单击空白区域

单击列表视图上的空白区域并取消选择项目时,我需要执行特定功能(例如:禁用按钮): 如果我点击这个

回答 2 投票 0

Flutter IconButton onPressed 从不触发

因为我不知道 ListTiles 的存在,所以我从头开始实现了以下内容: 我的小部件结构如下所示: StudiesItemWidget(相当于widget的脚手架,包含以下三个)

回答 1 投票 0

Flutter IconButton onPressed 从不触发

因为我不知道 ListTiles 的存在,所以我从头开始实现了以下内容: 我的小部件结构如下所示: StudiesItemWidget(相当于widget的脚手架,包含以下三个)

回答 1 投票 0

RenderFlex 错误未通过 shrinkWrap、SizedBox 或 Expanded 解决

我目前正在构建一个 AlertDialog 来显示对特定菜肴的评论。 我收到以下错误: 在 performLayout() 期间抛出了以下断言: RenderShrinkWrappingViewport 做 ...

回答 0 投票 0

如何在页面重定向和后退点击上保留列表视图图标

我有一个用 html、css、javascript 编写的页面,它有两个图标(即平铺视图和列表视图)。 一旦从“平铺视图”切换到“列表视图”,我就会在 gr 中显示记录...

回答 0 投票 0

在 ListViewItem 中过滤组合框

我有一个由 ListView 表示的映射表: 我有一个由 ListView 表示的映射表: <ListView Name="PaycodeMapping_ListView" ItemsSource="{Binding Model.PaycodeMappings, NotifyOnSourceUpdated=True}" <ListView.ItemTemplate> <DataTemplate> <!-- Company Code --> <ComboBox Name="CompanyCode_ComboBox" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" ItemsSource="{Binding DataContext.CompanyList, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" SelectedItem="{Binding Path=Company, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Grid.Row="0" Grid.Column="1"/> <!-- Paycode ComboBox --> <ComboBox Name="Paycode_ComboBox" HorizontalAlignment="Left" Width="125" ItemsSource="{Binding Path=DataContext.Paycodes, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" DisplayMemberPath="CodeDesc" SelectedItem="{Binding Path=Paycode, NotifyOnSourceUpdated=True, Mode=TwoWay}" Grid.Row="0" Grid.Column="2" /> 对象Paycodes是一组对象,每个对象包含一个CompanyCode、PayrollCode和CodeDesc。例如: 公司代码 工资代码 代码描述 001 瓦卡 假期 001 1000 正常工资 001 1010 加班 002 2000 假期 002 2001 轮班工资 002 3000 每小时加班 我想根据Paycodes中的Paycode_ComboBox过滤SelectedItem中显示的CompanyCode_ComboBox列表。因此,如果选择公司 001,则仅假期、正常工资和加班费将在 Paycode_ComboBox 中可用。 我的问题是如何过滤每个单独的 ListViewItem Paycode_ComboBox. 我的问题是如何过滤每个单独的 ListViewItem Paycode_ComboBox。 您应该首先绑定到经过过滤的付费代码集合。 解决此问题的 MVVM 方法是将一个 IEnumerable<Paycode> 属性添加到表示 ListView 中的项目的类型,并将此属性填充到 Company 属性的设置器中,该属性在您选择公司时设置另一个ComboBox. 所以不要将第二个ComboBox绑定到视图模型的CompanyList属性。将其绑定到项目类的属性: <ComboBox Name="Paycode_ComboBox" HorizontalAlignment="Left" Width="125" ItemsSource="{Binding Paycodes}" DisplayMemberPath="CodeDesc" SelectedItem="{Binding Path=Paycode, NotifyOnSourceUpdated=True, Mode=TwoWay}" Grid.Row="0" Grid.Column="2" /> 你需要的是一个 CollectionViewSource. 没有关于您的模型的更多信息,我无法举出更具体的示例,但请考虑以下几点: ViewModel(使用 CommunityToolkit.MVVM) public class DemoViewModel : ObservableObject { public IEnumerable<string> Cities {get;} = new List<string> { "Atlanta", "Buffalo", "Austin", "Anchorage", "Columbus", "Cincinnati", }; public IEnumerable<char> Letters { get; } = new List<char> { 'A', 'B', 'C', }; private char _selectedLetter = 'A'; public char SelectedLetter { get => _selectedLetter; set => SetProperty(ref _selectedLetter, value); } } 窗口: <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp1" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Window.DataContext> <local:DemoViewModel/> </Window.DataContext> <Window.Resources> <CollectionViewSource x:Key="citiesView" Source="{Binding Cities}"/> </Window.Resources> <StackPanel> <ComboBox x:Name ="LetterSelector" ItemsSource="{Binding Letters}" SelectedItem="{Binding SelectedLetter}" SelectionChanged="LetterSelector_SelectionChanged"/> <ComboBox ItemsSource="{Binding Source={StaticResource citiesView}}"/> </StackPanel> </Window> 代码隐藏: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); ((CollectionViewSource)Resources["citiesView"]).View.Filter = item => (((string)item).StartsWith(((DemoViewModel)DataContext).SelectedLetter)); } private void LetterSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { ((CollectionViewSource)Resources["citiesView"]).View.Refresh(); } } 或者,您可以将 CollectionViewSource 创建为视图模型中的一个属性,并将组合框绑定到它以消除代码隐藏,但这是一个特定于 Windows 的 API,因此如果您希望让您的 ViewModels 平台不可知,那将不会理想。 public class DemoViewModel : ObservableObject { public DemoViewModel() { Cities.Filter = item => (((string)item).StartsWith(SelectedLetter)); } public ICollectionView Cities {get;} = CollectionViewSource.GetDefaultView(new List<string> { "Atlanta", "Buffalo", "Austin", "Anchorage", "Columbus", "Cincinnati", }); public IEnumerable<char> Letters { get; } = new List<char> { 'A', 'B', 'C', }; private char _selectedLetter = 'A'; public char SelectedLetter { get => _selectedLetter; set { if (SetProperty(ref _selectedLetter, value)) { Cities.Refresh(); } } } } <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp1" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Window.DataContext> <local:DemoViewModel/> </Window.DataContext> <StackPanel> <ComboBox ItemsSource="{Binding Letters}" SelectedItem="{Binding SelectedLetter}"/> <ComboBox ItemsSource="{Binding Cities}"/> </StackPanel> </Window> 如果需要,您也可以使用 ObservableCollection 而不是 List。

回答 2 投票 0

我如何过滤 ArrayList ......通过 SearchView 或任何代码

**我如何通过 SearchView 查询或其他代码过滤 ArrayList 我有这个 ArrayList listitem_alls = new ArrayList<>();在 string.xml 文件中我想要适合...

回答 0 投票 0

ListView 样式添加省略号 (...) 到所有截断的文本

我想在我的 WPF 应用程序中为我的 ListView 创建样式,这使它们看起来更像 Windows 资源管理器 ListView。我坚持的是网格/细节中出现的省略号(...)...

回答 1 投票 0

是否可以在 WPF 列表视图中实现平滑滚动?

是否可以像在 Firefox 中那样在 WPF 列表视图中实现平滑滚动? 当 Firefox 浏览器包含所有列表视图项并且您按住鼠标中键(但不是...

回答 6 投票 0

有没有办法对不同大小的代表使用 StrictlyEnforceRange?

用于说明问题的代码示例: 导入 QtQuick 2.15 列表显示 { 型号:10 highlightRangeMode:ListView.StrictlyEnforceRange preferredHighlightBegin: width / 2 - currentItem.

回答 1 投票 0

“未找到材料小部件。”

我创建了一个列表视图,其中我使用了 gero 小部件我已经将所有英雄小部件和列表视图小部件包装在材料中但我仍然收到此错误并且当我单击 listtile 时它工作正常......

回答 0 投票 0

Listener 未检测到在 Flutter 中从一个列表视图拖动到另一个列表视图

我正在尝试在 flutter 中实现多个列表视图之间的拖放。 基本思想如下:- 这些项目将在列表视图之间拖动,为此我使用了 Draggable 和

回答 0 投票 0

如何在 Xamarin Forms 中引用列表视图中的自定义滑块

我有一个自定义滑块,并试图将它放在带有网格的列表视图中,以便列表视图显示以下内容:左上角:列表中的项目作为字符串。左下角:(在每个项目下)自定义

回答 0 投票 0

如何使 Maui ListView 上下文菜单获得单击的单元格

我需要获取在ListView中右键单击的单元格对象 这不是一个 mvvm 项目

回答 0 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.