listbox 相关问题

一个图形用户界面元素,允许用户从列表中选择一个或多个项目。

在级联组合框和列表框1中显示过滤后的数据

我这里有级联组合框,过滤后将在ListBox1中正确显示。下面是我的 Sheet1 数据(请不要介意它们的排列方式,因为它们是有目的的,我将添加更多...

回答 1 投票 0

为什么我的由数据表填充的列表框显示“System.Data.DataRow”而不是实际值?

我正在尝试使用 C# 从数据库填充列表视图或列表框。我正在使用数据表来获取数据。我正在使用下面的代码。但是列表视图或列表框正在填充类似“

回答 4 投票 0

基于组合框选择和文本框值的VBA搜索列表框

全面披露,这是 Chandoo 上帖子的延续 我是VBA菜鸟。我得到了帮助才能走到这一步。我的文件链接如下。为什么我的列表框只显示一行/结果?当我选择合作...

回答 1 投票 0

ItemsControl 与其项目源不一致 - WPF 列表框

我有一个 WPF 窗口,其中包含一个 ListBox 控件,当执行按钮单击方法时会填充该控件。 XAML: ...

回答 6 投票 0

ComBox 更改后用时间计算填充列表框

我这里有一个简单的用户表单,它根据组合框的更改填充列表框。 组合框中唯一列表的代码: 私有子用户窗体_Initialize() '使用此代码获得动态组合框...

回答 1 投票 0

无法在C#数据库访问中更新数据

我的按钮3有问题,它是更新按钮,消息框一直说这是更新语句中的语法错误。而且,如果我创建另一个列表框,如果我插入新数据,它......

回答 2 投票 0

ZK 列表框:当 hflex=min 时水平滚动条不会出现(在其他容器/选项卡框中)

这是问题的一个快照: 链接到问题图片 布局在没有 hflex="min" 的情况下可以正常工作 - 但当然,列太窄了。这是爆炸: 这是问题的一个快照: 问题图片链接 布局在没有 hflex="min" 的情况下可以正常工作 - 但当然,列太窄了。这是爆炸: <?xml version="1.0" encoding="UTF-8"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> <zk> <style> .module-alternative-amount-cell { text-align: right; } .cost-entry-alternative-amount-cell { text-align: right; } </style> <window id="thisEditor" width="99%"> <!-- header label --> <vbox> <space height="5px" /> <hbox> <space width="5px" /> <label id="header" value="A header" style="font-weight:bold;font-size:16px;color:#525252" /> </hbox> <space height="5px" /> </vbox> <groupbox mold="3d"> <caption label="General Information" style="font-weight:bold"> </caption> <grid> <columns> <column label="" width="20%" valign="top" /> <column label="" width="80%" valign="top" /> </columns> <rows> <row style="background: white;border:none"> <label value="Name" /> <textbox id="nameText" width="350px" ></textbox> </row> </rows> </grid> </groupbox> <space height="5px" /> <groupbox mold="3d"> <tabbox id="editorTabbox"> <tabs> <tab label="A" /> <tab label="M" /> </tabs> <tabpanels> <tabpanel > <listbox > <listhead sizable="true"> <listheader label="Name" sort="auto(name)" sortDirection="descending" /> <listheader label="Description" /> </listhead> <listitem > <listcell label="n1" /> <listcell label="d1" /> </listitem> <listitem > <listcell label="n2" /> <listcell label="d2" /> </listitem> </listbox> </tabpanel> <tabpanel id="mtp" > <vbox id="modulesTabpanelVbox" spacing="2" width="99%"> <listbox > <listhead sizable="true"> <listheader label="Name" sort="auto(name)" sortDirection="descending" hflex="min"/> <listheader label="Description Description Description Description Description Description" hflex="min" /> <listheader label="Description Description Description Description Description" hflex="min" /> <listheader label="Description" hflex="min"/> <listheader label="Description" hflex="min"/> </listhead> <listitem > <listcell label="n1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> </listitem> <listitem > <listcell label="n2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> </listitem> </listbox> <listbox > <listhead sizable="true"> <listheader label="Name" sort="auto(name)" sortDirection="descending" hflex="min"/> <listheader label="Description" hflex="min"/> <listheader label="Description Description Description Description Description" hflex="min"/> <listheader label="Description" hflex="min"/> <listheader label="Description Description Description Description" hflex="min"/> </listhead> <listitem > <listcell label="n1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> </listitem> <listitem > <listcell label="n2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> </listitem> </listbox> </vbox> </tabpanel> </tabpanels> </tabbox> </groupbox> </window> </zk> 考虑到示例的长度,我只添加了几列,请缩小浏览器窗口以查看问题,然后重新加载页面。 (编辑:我在列表头上添加了 sizing=true ,现在您可以通过使列更宽来强制显示水平滚动条。此外,只有在有两个选项卡时才能显示滚动条。) 背景:我发现了一些可能朝同一方向发展的问题,但我没有找到解决我的问题的方法。请注意,我不想将“overflow:auto;”添加到选项卡面板 - 这会破坏我对选项卡面板的使用。事实上,我在这段代码周围有一个外部选项卡面板,并且必须在那里添加滚动条,这使得所有选项卡面板增加滚动条...滚动条甚至不在选项卡面板空间的底部。很抱歉,如果这很复杂,如果您布置了这样的内容,您可能会有一个想法。 此外,我当然不想要固定尺寸。 旁注:缩小(浏览器)窗口并不会缩小列表框 - 增大列表框没有问题。这里有东西! 谢谢! 这可能会解决你的问题,我在VBOX之前添加了一个DIV,你可以在下面注意到它 <tabpanel id="mtp" > <--------## your 2nd panel ### <div style="overflow:auto;position:relative"> <--change### <vbox id="modulesTabpanelVbox" spacing="2" width="99%"> <listbox > <listhead sizable="true"> <listheader label="Name" sort="auto(name)" sortDirection="descending" hflex="min"/> <listheader label="Description Description Description Description Description Description" hflex="min" /> <listheader label="Description Description Description Description Description" hflex="min" /> <listheader label="Description" hflex="min"/> <listheader label="Description" hflex="min"/> </listhead> <listitem > <listcell label="n1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> </listitem> <listitem > <listcell label="n2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> </listitem> </listbox> <listbox > <listhead sizable="true"> <listheader label="Name" sort="auto(name)" sortDirection="descending" hflex="min"/> <listheader label="Description" hflex="min"/> <listheader label="Description Description Description Description Description" hflex="min"/> <listheader label="Description" hflex="min"/> <listheader label="Description Description Description Description" hflex="min"/> </listhead> <listitem > <listcell label="n1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> <listcell label="d1" /> </listitem> <listitem > <listcell label="n2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> <listcell label="d2" /> </listitem> </listbox> </vbox> </div> <----- change </tabpanel> 问候, 安缦

回答 1 投票 0

根据当前Application.UserName显示列表框

我这里有一个代码,源自在当前日期正确显示列表框的答案。如果我有一个存储不同用户名的 B 列,我想将其插入代码中: 如果当前

回答 1 投票 0

列表框到 Excel 工作表

我这里有一个按人名过滤的列表框。当从组合框中选择名称时,列表框将正确填充。我想要实现的是当列表框显示时......

回答 1 投票 0

列表框拒绝更新/列表没有匹配的类型

简而言之,我想创建一个可更新的列表框,它会在从组合框中选择选项时更新 简而言之,我想创建一个可更新的列表框,它会在从组合框中选择选项时进行更新 <ListBox Background="Transparent" Width="Auto" Height="Auto" HorizontalAlignment="Right" ScrollViewer.CanContentScroll="true" ItemsSource="{Binding Lessons, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="{Binding LessonText, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"> <StackPanel> </StackPanel> </TextBlock> <Image Source="{Binding LessonImage, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" HorizontalAlignment="Center" Width="auto" MaxWidth="400"/> </WrapPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> 更改变量 Lesson 的值会触发一个操作,该操作会用元素填充对象列表 public class LessonData : BaseViewModel { public int _lessonID; public string _lessonText; public byte[] _lessonImage; public int LessonID { get { return _lessonID; } set { _lessonID = value; OnPropertyChanged(nameof(LessonID)); } } public string LessonText { get { return _lessonText; } set { _lessonText = value; OnPropertyChanged(nameof(LessonText)); } } public byte[] LessonImage { get { return _lessonImage; } set { _lessonImage = value; OnPropertyChanged(nameof(LessonImage)); } } } public List<LessonData> editedLessons = new List<LessonData>(); public List<LessonData> EditedLessons { get { return editedLessons; } set { editedLessons = value; OnPropertyChanged(nameof(EditedLessons)); } } public string Lesson { get { return _lesson; } set { _lesson = value; OnPropertyChanged(nameof(Lesson)); if (Lesson == "None") { EditedLessons.Clear(); IsLessonBeingEdited = false; } else { EditedLessons = lessonRepository.Obtain_Lesson_Content(Lesson); foreach (LessonData p in EditedLessons) { Console.WriteLine(p.LessonID, p.LessonText, p.LessonImage); } IsLessonBeingEdited = true; } } } 这是存储库中的函数 public List<LessonData> Obtain_Lesson_Content(string Lesson) { List<LessonData> lc = new List<LessonData>(); using (var connection = GetConnection()) using (var command = new SqlCommand()) { connection.Open(); command.Connection = connection; command.CommandText = "SELECT Id_Lesson_Content, Lesson_Text, Lesson_Image FROM [Lesson_Content] WHERE Id_Lesson_Title = (SELECT Id_Lesson FROM [Lesson_Title] WHERE Lesson_Title = @title)"; command.Parameters.Add("@title", SqlDbType.NVarChar).Value = Lesson; using (var reader = command.ExecuteReader()) { while (reader.Read()) { LessonData model = new LessonData(); model.LessonID = (int)reader["Id_Lesson_Content"]; model.LessonText = reader["Lesson_Text"].ToString(); if (reader["Lesson_Image"] != System.DBNull.Value) model.LessonImage = (byte[])reader["Lesson_Image"]; else model.LessonImage = null; lc.Add(model); } reader.NextResult(); } foreach (LessonData p in lc) { Console.WriteLine(p.LessonID, p.LessonText, p.LessonImage); } return lc; } } 然而,每次我触发该函数时,我都会遇到抛出的错误(在这种情况下,它正在加载两个对象,一个带有图像,一个没有图像): System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'System.Byte[]' and 'System.Windows.Media.ImageSource'. Consider using Converter property of Binding. BindingExpression:Path=LessonImage; DataItem='LessonData' (HashCode=2419756); target element is 'Image' (Name=''); target property is 'Source' (type 'ImageSource') System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='System.Byte[]' BindingExpression:Path=LessonImage; DataItem='LessonData' (HashCode=2419756); target element is 'Image' (Name=''); target property is 'Source' (type 'ImageSource') System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'System.Byte[]' and 'System.Windows.Media.ImageSource'. Consider using Converter property of Binding. BindingExpression:Path=LessonImage; DataItem='LessonData' (HashCode=10026414); target element is 'Image' (Name=''); target property is 'Source' (type 'ImageSource') 但对我来说,最奇怪的部分是尝试在控制台中写入所有列表对象会引发这三个错误: 无法从 int 转换为 char[], 从字符串到整数 从 byte[] 到 int foreach (LessonData p in lc) { Console.WriteLine(p.LessonID, p.LessonText, p.LessonImage); } 比如,为什么会发生这种情况?我查看了其他相同/相似的函数,它们以相同的方式工作,并且它们都没有抛出此类编译错误。最重要的是,当我通过将LessonID放在最后来更改对象元素的顺序时,它不会显示错误(但是显示的唯一项目是LessonText)。 无论是什么原因,我相信它隐藏在阅读列表的错误背后。 错误消息的来源是绑定表达式 Source="{Binding LessonImage, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" 虽然存在从 string、Uri 和 byte[] 到 ImageSource(Source 属性的类型)的内置自动类型转换,但不会自动转换回这些类型(字符串除外) . 除此之外, Source 属性的双向绑定是没有意义的,因为 Image 元素本身永远不会更改该属性。这同样适用于 TextBlock 元素的 Text 属性绑定。 解决方案是使用 OneWay Binding,其中设置 UpdateSourceTrigger 也是毫无意义的,因为它只影响 TwoWay 和 OneWayToSource Binding。 Source="{Binding LessonImage}"

回答 1 投票 0

如何仅使用工作表中的某些列填充列表框?

我有一个使用以下代码填充的列表框: 私有子用户form_initialize() 昏暗的工作表 调暗 Rng As 范围 变暗 LRow 一样长 变暗 Myarray 作为变体 设置 ws = ThisWorkbook.Sheets(Mark1.

回答 1 投票 0

如何在列表框中显示字典

我正在尝试将字典中的键/值对显示到列表框。 核心价值 一个 10 乙20 碳30 我想以以下格式将它们显示在列表框中 甲(10) 乙(20) C(30) 使用以下...

回答 4 投票 0

从 Excel 工作表到列表框显示与其他列的唯一值

我这里有数据,我想获取 C 列 = 项目 ID 的唯一值。 日期 ||项目编号 ||实施领域||开始时间 ||结束时间 ||地位 2023 年 8 月 28 日 || 1145544 ||

回答 1 投票 0

单击启用宏的按钮时列表框不显示条目

我有一个列表框,当从 Excel 工作表中单击按钮时,应该在初始化中显示条目。 该按钮正在调用一个模块来显示表单。 模块代码: 选项显式 子翔...

回答 1 投票 0

使用一个滚动条滚动多个列表框而不使用类

我想在 Tkinter 中使用单个(垂直)滚动条同时(同步)滚动多个列表框。 问题是 Stack Overflo 上的所有解决方案......

回答 2 投票 0

同时滚动多个 Tkinter 列表框

我有多个 Tkinter 列表框,我使用单个滚动条将它们一起滚动,但我还希望它们一起滚动以在任何列表框上进行鼠标滚轮活动。 怎么办...

回答 5 投票 0

无法编译64位CXTipListBox

我正在尝试从此处的类中获取 CXTipListBox: https://www.codeproject.com/Articles/4438/XTipComboBox-Display-tooltips-for-combobox 将其用于对话框上的 CListBox 控件。 它...

回答 1 投票 0

Excel VBA 表单在列表框中显示带有时间计算的唯一条目

我想请您帮助解决我的以下问题。我这里有两种不同的形式。用于保存条目的表格 1。为了保存条目,我已经有了代码。它已经开始工作了。表格 2 是用来显示...

回答 1 投票 0

在用户表单初始化期间设置列表框(在 VBA 中)的列宽时,Excel 崩溃

问题:每次我尝试加载用户表单(“MS Excel 已停止响应”)时,特别是在设置列表框的列宽时,我的 MS Excel 都会间歇性崩溃。 背景:使用

回答 2 投票 0

GUI 中的 Python Tkinter 列表框文本编辑

有没有办法编辑列表框项目而不是删除它? 我正在使用带有列表框的 tkinter GUI。现在我的列表框可以包含例如 10 个项目。如果我想更改一项的文本...

回答 2 投票 0

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