combobox 相关问题

Combobox允许从多个选项中选择一个(类似于下拉列表),或者键入自定义选项。

React:创建组合框

这里的学生,尝试使用 Laravel、React 和 Inertia 为我的论文创建一个应用程序。 我正在尝试创建一个简单的、可重用的 Combobox 组件。它需要有一个 id HTML 属性并且需要...

回答 1 投票 0

Tkinter Python 自动填充组合框没有响应

各位互联网上的朋友大家好!我正在 python 和 tkinter 中制作股票预测模型,但当我尝试在组合框小部件上搜索“a”时,我遇到了无响应 Python 的问题。梳子...

回答 1 投票 0

如何使用另一个表中的数据填充 ComboBox,同时使用另一个表中彼此有关系的数据填充 DataGridView

我想用另一个表中的数据填充第一个 ComboBox,用另一个表中的数据填充第二个 ComboBox,并用与这两个表都有关系的表填充 DataGridView...

回答 1 投票 0

Excel Ribbon 组合框:如何设置 getSelectedItemIndex 回调

这是此问题的后续问题: Excel Ribbon组合框:始终突出显示选择 以下代码允许您使用组合框从三种纸张尺寸中进行选择。 只有一个问题...

回答 1 投票 0

Excel Ribbon 组合框:设置多张纸张尺寸

此代码允许您在工作簿中的三个工作表之间进行选择: Excel Ribbon组合框:始终显示当前选择 我正在尝试调整它以使用组合框从三个页面大小中进行选择...

回答 1 投票 0

Excel Ribbon 组合框:始终显示当前选择

这是此问题的后续问题: Excel Ribbon 组合框:始终显示当前选择并在保存前记住选择 我正在尝试设置一个组合框来选择工作表。 “或者...

回答 1 投票 0

Excel Ribbon 组合框:始终显示当前选择并在保存前记住选择

如何设置组合框,以便它始终更新/刷新其显示并始终显示当前选择? A。 在此示例中,我可以选择工作表。如果我通过组合框选择,则一切都

回答 2 投票 0

Excel Ribbon 组合框:如何设置 onChange 回调

在自定义功能区中设置组合框。 不明白,如何构建 onChange 回调。 这是组合框 XML: 在自定义功能区中设置组合框。 不明白,如何构建onChange回调。 这是组合框 XML: <group id="GroupDemo2" label="SelectSheet" autoScale="true" imageMso="AddInManager"> <comboBox id="ComboBox001" label="comboBox001” sizeString=“XXXX” onChange="RibbonCallbacks.ComboBox001OnChange" getText="RibbonCallbacks.ComboBox001GetText"> <item id="ItemOne” label=“One”/> <item id="ItemTwo” label=“Two”/> <item id="ItemThree” label=“Three”/> </comboBox> </group> 我尝试过这个,但没有做任何事情: Sub ComboBox001OnChange(control As IRibbonControl, id As String) Select Case id Case "ItemOne” Sheets("Sheet1”).Select Case "ItemTwo” Sheets("Sheet2”).Select Case "ItemThree” Sheets("Sheet3”).Select End Select End Sub 它适用于下拉菜单,但不适用于组合框。 然后是第二个回调: 'Callback for ComboBox001 getText Sub ComboBox001GetText(control As IRibbonControl, ByRef returnedVal) returnedVal = "One" End Sub 我也需要这个吗? 谢谢! 您的报价有问题,他们没有验证,修复报价后现在已验证,看起来可以正常工作。 <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon> <tabs> <tab id="customTab" label="Contoso" insertAfterMso="TabHome"> <group id="GroupDemo2" label="SelectSheet" autoScale="true" imageMso="AddInManager"> <comboBox id="ComboBox001" label="comboBox001" sizeString="XXXX" onChange="RibbonCallbacks.ComboBox001OnChange" getText="RibbonCallbacks.ComboBox001GetText"> <item id="ItemOne" label="One"/> <item id="ItemTwo" label="Two"/> <item id="ItemThree" label="Three"/> </comboBox> </group> </tab> </tabs> </ribbon> </customUI> 关于第二个子。检查 Microsoft doc 中的组合框,在功能区中搜索 getText 并决定是否需要它。 https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.ribbon.ribboncombobox?view=windowsdesktop-8.0#events

回答 1 投票 0

无法在选项卡或单选组组件内使用 vue headless ui 组合框滚动条

我无法在无头 UI 选项卡组件中使用滚动条,当我单击并滚动滚动条时,组合框将关闭。ComboBoxInput 出现关闭滚动条的问题。 那一刻...

回答 1 投票 0

VB |将 SQL 查询加载到组合框中

我正在尝试用 SQL 结果填充组合框 我认为我的问题是处理数据表形式的数据。 将 sql 变暗为字符串 昏暗的 sqlquery 作为字符串 将连接字符串变暗为字符串 ...

回答 2 投票 0

从 UserControl 公开 ComboBox.ItemsSource

我创建了一个简单的 WPF UserControl,其中包含一个 ComboBox,我想公开后者的 ItemsSource 属性以从父视图绑定集合。 这是 xaml ...

回答 1 投票 0

WPF/C# - dropbox 样式 - 无法单击 ToggleButton 背景

我到处收集代码来制作自定义组合框 但我只能点击箭头来选择一个项目 我希望能够单击整个 ToggleButton,而不仅仅是箭头 由于某种原因

回答 1 投票 0

代码在一个子项中给出类型不匹配,但在另一个子项中没有给出类型不匹配

您好,我有一个用户表单,其中包含 3 个组合框:TaskStartTime、TaskFinishTime 和 Task_Duration。 计划是您更改用户表单中的开始或结束值,并且持续时间值发生变化...

回答 1 投票 0

如何使用组合框中放入的另一个字符串值列表的输入来获取列表的整数值?

我对 Dearpygui 比较陌生,并且在尝试使用组合框使用项目中另一个列表的字符串值从存储在 user_data 中的列表中回调指定的 int 值时遇到麻烦...

回答 1 投票 0

带有 contains 的 WPF 组合框文本搜索

我如何使用 contains 而不是 StartsWith 来实现我的 Combobox TextSearch 我如何使用 contains 而不是 StartsWith 来实现我的组合框文本搜索 <rf:ComboBox Grid.Row="1" Grid.Column="5" Width="200" ItemsSource="{Binding Source={StaticResource AccountProvider}}" DisplayMemberPath="Description" SelectedValuePath="IndRekId" IsEmptyItemVisible="True" SelectedValue="{Binding Id, UpdateSourceTrigger=PropertyChanged}" IsTextSearchEnabled="True" TextSearch.TextPath="Description" IsEditable="True"/> 搜索功能可以工作,但我需要匹配子字符串 这里我有一个MVVM框架的例子。 我的xaml文件: <ComboBox Name="cmbContains" IsEditable="True" IsTextSearchEnabled="false" ItemsSource="{Binding pData}" DisplayMemberPath="wTitle" Text="{Binding SearchText ,Mode=TwoWay}" > <ComboBox.Triggers> <EventTrigger RoutedEvent="TextBoxBase.TextChanged"> <BeginStoryboard> <Storyboard> <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsDropDownOpen"> <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:0"/> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </ComboBox.Triggers> </ComboBox> 我的cs文件: //ItemsSource - pData //There is a string attribute - wTitle included in the fooClass (DisplayMemberPath) private ObservableCollection<fooClass> __pData; public ObservableCollection<fooClass> pData { get { return __pData; } set { Set(() => pData, ref __pData, value); RaisePropertyChanged("pData"); } } private string _SearchText; public string SearchText { get { return this._SearchText; } set { this._SearchText = value; RaisePropertyChanged("SearchText"); //Update your ItemsSource here with Linq pData = new ObservableCollection<fooClass>{pData.ToList().Where(.....)}; } } 您可以看到可编辑的组合框绑定到字符串(SearchText) 一旦发生 TextChanged 事件,就会显示下拉菜单,并且双向绑定会更新值。 当进入 set{} 时,cs 文件中的 ItemsSource 发生了变化;语法。 https://gist.github.com/tonywump/82e66abaf71f715c4bd45a82fce14d80 这个示例看起来像“TextSearch” 在 XAML 文件中,您应该只向组合框“TextContainSearch.Text”添加一个属性: <ComboBox ItemsSource="{Binding Model.formListIntDeviceNumbers}" SelectedItem="{Binding Path=Model.selectedDeviceNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="DeviceNumber" IsEditable="True" c:TextContainSearch.Text="DeviceNumber"> 我们应该在 XAML 文件的标头中添加 using : xmlns:c="clr-namespace:Adaptive.Controls.Extension" *.cs 文件中的 C# 代码: using System; using System.Windows; using System.Windows.Controls; namespace Adaptive.Controls.Extension { public sealed class TextContainSearch : DependencyObject { public static void SetText(DependencyObject element, string text) { var controlSearch = element as Control; if (controlSearch != null) controlSearch.KeyUp += (sender, e) => { if (sender is ComboBox){ var control = sender as ComboBox; control.IsDropDownOpen = true; var oldText = control.Text; foreach(var itemFromSource in control.ItemsSource){ if (itemFromSource != null) { Object simpleType = itemFromSource.GetType().GetProperty(text).GetValue(itemFromSource, null); String propertOfList = simpleType as string; if (!string.IsNullOrEmpty(propertOfList) && propertOfList.Contains(control.Text)) { control.SelectedItem = itemFromSource; control.Items.MoveCurrentTo(itemFromSource); break; } } } control.Text = oldText; TextBox txt = control.Template.FindName("PART_EditableTextBox", control) as TextBox; if (txt != null) { txt.Select(txt.Text.Length, 0); } } }; } } } 试试这个: <ComboBox Padding="3,5" MinWidth="150" SelectedItem="{Binding NewBoxRequest}" ItemsSource="{Binding Requests}" DisplayMemberPath="SN" IsEditable="True" StaysOpenOnEdit="True" Text="{Binding SnFilter,UpdateSourceTrigger=PropertyChanged}"> </ComboBox> 查看型号: private string snFilter; public string SnFilter { get { return snFilter; } set { snFilter = value; RaisePropertyChanged(); RaisePropertyChanged(nameof(Requests)); } } private List<Request> requests; public List<Request> Requests { get => string.IsNullOrEmpty(SnFilter) || requests.Any(r => r.SN == SnFilter) ? requests : requests.Where(r => r.SN.Contains(SnFilter)).ToList(); set { requests = value; RaisePropertyChanged(); } } 无法用 string.Contains() 替换 string.StartsWith()。您必须编写自定义组合框。 这篇文章可能会帮助您: http://www.codeproject.com/Tips/631196/ComboBox-with-Suggest-Ability-based-on-Substring-S 我无法让“Set”语法在我的 C# 系统中工作,所以这里是对上面 Wu 的答案的一个小起飞(这是在自定义控件中): <ComboBox IsEditable="True" IsTextSearchEnabled="false" ItemsSource="{Binding pData, RelativeSource = {RelativeSource TemplatedParent}}" DisplayMemberPath="description" Text="{Binding SearchText , RelativeSource = {RelativeSource TemplatedParent}, Mode=TwoWay}" > <ComboBox.Triggers> <EventTrigger RoutedEvent="TextBoxBase.TextChanged"> <BeginStoryboard> <Storyboard> <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsDropDownOpen"> <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:0"/> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </ComboBox.Triggers> </ComboBox> 在自定义控件中: private async void _Loaded(object sender, RoutedEventArgs e) { var n = await InitializeLabTests; allTests = new ObservableCollection<CommonProcedure>(n); pData = new ObservableCollection<CommonProcedure>(n); } //ItemsSource - pData //There is a string attribute - wTitle included in the fooClass (DisplayMemberPath) private ObservableCollection<CommonProcedure> __pData; public ObservableCollection<CommonProcedure> pData { get { return __pData; } set { __pData = value; RaisePropertyChanged(); } } private string _SearchText; public string SearchText { get { return _SearchText; } set { _SearchText = value; RaisePropertyChanged(); //Update your ItemsSource here with Linq pData = new ObservableCollection<CommonProcedure> ( allTests.Where(q => q.description.Contains(SearchText)) ); } } 唯一显着的区别在于 SearchText 设置器。 ComboBox KeyUp 事件上的动态事件怎么样: <ComboBox DisplayMemberPath="Label" Height="37" Padding="5" SelectedValue="{Binding Client, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding ClientList, UpdateSourceTrigger=PropertyChanged }" IsEditable="True" TextSearch.TextPath="Label" KeyUp="ComboBox_KeyUp" /> 活动: private void ComboBox_KeyUp(object sender, KeyEventArgs e) { var control = sender as ComboBox; if (control == null) { return; } if (control.Tag == null) { control.Tag = control.ItemsSource as List<ComboBoxItemViewModel>; } var filter = control.Text.ToLower(); if (filter.Length == 0) { // If no text, show all items control.ItemsSource = control.Tag as List<ComboBoxItemViewModel>; } else { var dataSource = control.Tag as List<ComboBoxItemViewModel>; if (dataSource == null) return; // Filter items based on the text entered control.ItemsSource = dataSource.Where(item => item.Label.ToLower().Contains(filter)).ToList(); } } //Just replace the List<ComboBoxItemViewModel> with your ViewModel

回答 6 投票 0

python tkinter 奇怪的 { 在列表中

我在选择部分中遇到了这个 {}。 即使在选择框中我也遇到了麻烦。 仅当列表中存在空格时才会发生这种情况。 将 tkinter 导入为 tk 从 tkinter 导入 ttk 所有用户 = [(7, '

回答 1 投票 0

组合框在搜索文本时选择第一项

我有一个组合框,我可以在其中输入文本,它会根据包含该文本的项目列表建议结果。一切似乎都工作正常,除了当我输入第一个字母时,

回答 1 投票 0

C# WPF Combobox 有两列,如何获取所选项目?

我有一个组合框: 我有一个组合框: <ComboBox x:Name="cmbOrganization_Config_AddSalGrp" FontSize="20" Margin="5 0 5 5" SelectedItem="{Binding OrgID}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Organization_Name}" Margin="0 0 20 0" Visibility="Visible"/> <TextBlock Text="{Binding OrgID}" Visibility="Visible"/> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> 我有这个隐藏代码: try { // Let the SqlCommand object know which stored procedure to execute SqlCommand cmd = new SqlCommand("tuc_salary_grouping_add", con); //Specify that it is a stored procedure and not a normal proc cmd.CommandType = System.Data.CommandType.StoredProcedure; // cmd.Parameters.AddWithValue("@SalaryGroupingName", this.SalaryGroupingConfig_add.Text); cmd.Parameters.AddWithValue("@Organization_ID", this.cmbOrganization_Config_AddSalGrp.SelectedItem); cmd.Parameters.AddWithValue("@Organization_ID", this.cmbOrganization_Config_AddSalGrp.Text); cmd.Parameters.AddWithValue("@Organization_ID", (this.cmbOrganization_Config_AddSalGrp.SelectedItem as ComboBoxItem).Content.ToString()); cmd.Parameters.AddWithValue("@Notes", string.Empty); // Open the connection and execute the stored procedure con.Open(); int rowsAffected = cmd.ExecuteNonQuery(); Debug.WriteLine($"SQL> New record insert was successfully - [{rowsAffected}]"); return true; } 用户选择该项目后,我需要从组合框中获取“OrgID”。 我尝试了3种不同的方法,但都不起作用。我的代码不是 MVVM 形式。 OrgID 是一个整数。我感谢你的帮助。 您可以使用 SelectionChanged 事件来检索所选项目。就像下面的例子: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { var Items = new List<ItemsOrga> { new ItemsOrga("Id1", "Orga1"), new ItemsOrga("Id2", "Orga2"), new ItemsOrga("Id3", "Orga3") }; cmbOrganization_Config_AddSalGrp.ItemsSource = Items; } private void cmbOrganization_Config_AddSalGrp_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { var SelectedItem = e.AddedItems[0] as ItemsOrga; Debug.WriteLine(SelectedItem.OrgID); } } } public class ItemsOrga { public string Organization_Name { get; set; } public string OrgID { get; set; } public ItemsOrga(string OrgID, string Organization_Name) { this.OrgID = OrgID; this.Organization_Name = Organization_Name; } }

回答 1 投票 0

EXT 4.2 使用 XTemplate 对结果进行 ComboBox 分组

我正在尝试对从商店获得的结果进行分组以显示在 ComboBox 内。 我有一个如下所示的组合框: 我需要它看起来像这样: 这意味着按类别分组...

回答 6 投票 0

如何使用 pywinauto 选择没有标题的组合框

在我的Windows应用程序中,有三个没有标题但有不同列表项的组合框。如何根据 ComboBox 包含的项目选择正确的 ComboBox。如果我只选择 Control_Type 我会得到

回答 1 投票 0

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