listbox

Searching a listBox for a specified string VB6

邮差的信 提交于 2019-12-09 12:02:43
问题 I have a listbox called lstSerial and a textbox called txtSerials. What I want to do is search lstSerial for the string that's entered in txtSerials. I'm using VB6 in Microsoft Visual Basic 6.0, and I'm having a terrible time finding documentation. Thanks. 回答1: @AlexK's answer is technically correct - yes - it will work, but it's not the preferred way to go. There is an API call for this very purpose: Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" _ (ByVal hWnd As Long

C# WPF ListBox Checkbox Binding IsChecked to a Field and IsSelected?

时光怂恿深爱的人放手 提交于 2019-12-09 04:44:36
问题 I'm trying to bind a CheckBox to a field but also trigger the checkbox's IsSelected. Here is the ListBox setup that is working with the Binding to data <ListBox x:Name="lstExclude" Grid.Column="2" SelectionMode="Single" > <ListBox.ItemTemplate> <DataTemplate> <CheckBox Content="{Binding Text}" IsChecked="{Binding Checked ,Mode=TwoWay}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> And here is the code associated with the binding public MainWindow() { InitializeComponent(); List

wpf border control to span the width of listboxItem

你说的曾经没有我的故事 提交于 2019-12-09 04:39:14
问题 Im trying to define a dataTemplate for a business object in my wpf application a collection of which is being bound to a ListBox. <UserControl.Resources> <DataTemplate x:Key="ResizedItemsDataTemplate" DataType="{x:Type resizer:ResizeMonitorItem}"> <Border x:Name="bdr" BorderBrush="Blue" BorderThickness="1" CornerRadius="2" Width="auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid Margin="2"> <Grid.RowDefinitions> <RowDefinition Height="14"></RowDefinition> <RowDefinition

Change disabled listbox background to gray

匆匆过客 提交于 2019-12-09 03:38:34
问题 I have a ListBox which I need to gray out when it's disabled. Per user request it's not enough to disable it, but it also has to appear differently. shrugs I've looked in several other places and followed the examples, and it seems as if it should work, but it does not. Here are some examples I looked at: Example1, Example2. Here is my code: <Style x:Key="ListBoxStyle" TargetType="ListBox"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}">

Get selected item in listbox and call another function storing the selected for it

我怕爱的太早我们不能终老 提交于 2019-12-09 03:20:55
问题 I have a canvas that calls createCategoryMeny(x) when it is clicked. This function just creates a Toplevel() window, def createCategoryMenu(tableNumber): ##Not interesting below: categoryMenu = Toplevel() categoryMenu.title("Mesa numero: " + str(tableNumber)) categoryMenu.geometry("400x400+100+100") categoryMenu.focus() categoryMenu.grab_set() Label(categoryMenu, text="Elegir categoria \n Mesa numero: " + str(tableNumber)).pack() ## RELEVANT CODE BELOW: listbox = Listbox(categoryMenu, width

Make a WPF ListBox comma separate values

限于喜欢 提交于 2019-12-09 03:16:30
问题 I have a ListBox that looks like this: <ListBox ItemsSource="{Binding Fruits}"> <!--Make the items wrap--> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel></WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name, StringFormat=' {0},'}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> This gives me a list like this: Oranges, Grapes, Bananas, But what I want is: Oranges, Grapes, Bananas (no trailing comma) Any one

Listbox scrollbar thumb changes size when content is variable height

妖精的绣舞 提交于 2019-12-09 00:45:38
问题 I have a ListBox with many objects displayed, each of which can be a variable height, based on the number of values each object has. See my previous question that was answered here. Many objects are 5-lines high, while others are 1. The scroll bar in the ListBox does not appear to like this, probably due to the virtualization. While you scroll through, the thumb on the scroll bar will change its size , based on how many items are actually fitting into the box at that current moment. This

Insert list in listbox

大兔子大兔子 提交于 2019-12-08 15:05:31
问题 I'm new to C# and I'm trying to explore in C#, however I try to add a list in a listbox. The error that I'm having is : Object reference not set to an instance of an object. Any idea how to resolve this? namespace WindowsFormsApplication { public partial class Form1 : Form { something a = something iets(); public Form1() { InitializeComponent(); } // part1 class something { public List<string> testing { get ; set; } } // part2 private void button1_Click(object sender, EventArgs e) { a.testing

Validating a ListBoxItem rather than a ListBox

主宰稳场 提交于 2019-12-08 12:58:26
I have a ListBox bound to a list of objects that implement IDataErrorInfo. I have set the ValidatesOnDataErrors property to True on my ListBox. If I select an invalid item, a red border appears around my ListBox. How can I modify my ItemContainerStyle such that the red border appears arround the selected item rather than the actual ListBox? You can set ValidatesOnDataErrors in the ListBox's ItemTemplate directly, on the Binding which binds the bound item's property to the control that displays it. That should make the red border show up around the control in question. If, in addition to that,

Windows Phone 7: ListBox SelectionChanged event

我与影子孤独终老i 提交于 2019-12-08 12:55:32
问题 I'm new to XAML and Windows Phone 7 SDK. I'm developing an Windows Phone 7 application and I don't know how to detect selected item from the ListBox. I'm using panorama template, here is my code: <controls:PanoramaItem Header="Basic"> <ListBox Margin="0,0,-12,0" Name="MyListBox" SelectionChanged="Elementary_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,0,0,17"> <Image Height="100" Width="100" Source="{Binding LevelPassedImage}" Margin=