listbox

Using Linq To Convert ListBox Items Values to int

南楼画角 提交于 2019-12-13 16:57:57
问题 I display the contents of a table in the database using a ListBox. Each listbox item is populated with the Text property set to a friendly name, and the Value property set to the unique ID column. The database structure might look similar to the following: CREATE TABLE GENERIC { FRIENDLY_NAME TEXT, ID INT } I tried for almost an hour to convert the items of the listbox to an int[] using LINQ and ultimately failed. It is also important to distinguish between the selected and not selected items

How to have a multi-coloured items of a ListBox in winforms?

妖精的绣舞 提交于 2019-12-13 16:07:54
问题 I am developing a software in winforms, I am stuck in a step where I have List<KeyValuePair<string, string>>. and some sample data: List <KeyValuePair<"S", "1200">> List <KeyValuePair<"S", "1300">> List <KeyValuePair<"L", "1400">> I want to diplay the value of the key pair inside a ListBox, where based in the key of the pair the Item on the ListBox has a diffrent colour, for example if the Key is S, then the Item should be red and if the Key is L the Item should be blue. Hope you could help

WPF Listbox wont scroll Vertical

早过忘川 提交于 2019-12-13 15:47:28
问题 Within a Groupbox I have a Listbox, ListboxItems are defined in the XAML as well. The Listbox is defined: <ListBox Name="lvAvoidCountry" Margin="5,5,5,5" Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > Items are defined like this: <ListViewItem > <CheckBox Name="chkAlbanien" Tag="55"> <StackPanel Orientation="Horizontal"> <Image Source="images/flag_albania.png" Height="30"></Image> <TextBlock Text="Albanien"

Winform customize listbox item

给你一囗甜甜゛ 提交于 2019-12-13 15:44:30
问题 I have a listbox that should display data that contains 2 fields: time and a message. Instead of displaying 1 line of text, I want each item to be displayed as 2 lines - 1st line is the time and the 2nd line is the message, where each line has a different style. How can I do this? I can bind the object array to the listbox, but how do I style it? Thanks for your answers. 回答1: I'll just formally post an answer earlier left in a comment. You'll need to use the DrawMode property, there's a good

Create ItemTemplate for ListBox in code-beind in WPF

人盡茶涼 提交于 2019-12-13 14:51:16
问题 I'm trying to create an ItemTemplate for a ListBox programmatically but it doesn't work. I know in XAML I can have something like: <ListBox x:Name="listbox" BorderThickness="0" Margin="6" Height="400"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Margin="0" Background="Red" Foreground="White" FontSize="18" Text="{Binding}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> But when I'm trying to have the above result programmatically I face a problem which is binding the TextBox

WP8: Change the Listboxitem Datatemplate on Selection Changed

人盡茶涼 提交于 2019-12-13 09:51:13
问题 I have a listbox in windows phone 8, For that i want to change the datatemplate for the Selected Item. I have done this is WPF like : <Window.Resources> <DataTemplate x:Key="ItemTemplate"> <TextBlock Text="{Binding}" Foreground="Red" /> </DataTemplate> <DataTemplate x:Key="SelectedTemplate"> <TextBlock Text="{Binding}" Foreground="Green" /> </DataTemplate> <Style TargetType="{x:Type ListBoxItem}" x:Key="ContainerStyle"> <Setter Property="ContentTemplate" Value="{StaticResource ItemTemplate}"

Check proxy's from listbox

岁酱吖の 提交于 2019-12-13 09:34:55
问题 So i have a listbox that i have there for a list of proxies. I have 4 buttons pertaining to it. they are find, load, save and check I have the first 3 finished and working but i haven't found anything useful pertaining to checking the proxies, the only one that i found took like 6 seconds per proxy so it took a lot of time for a decent sized list. So how could i make it that on the press of that button, it checks all of the proxies in the listbox and it deletes the slow ones and the ones that

Visual Basic enter information in an array

穿精又带淫゛_ 提交于 2019-12-13 09:24:29
问题 I have two text boxes to enter the Name and the Marks of students. I don't know how to create the array for it in Visual Basic The array must be multidimensional and also needs to have an index that increments every time a new mark and name is entered. Once the array is completed I need the results to show in a list box. Thank you EDIT!!! This is the code i now have but i still have few errors Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

Drag Drop ListBoxItems from ListBox1 to ListBox2 with their images and avoiding duplication Delphi

烈酒焚心 提交于 2019-12-13 09:13:24
问题 My code is working and the drag and drop but what i want to add is to Drag and Drop items from ListBox1 to ListBox2 with their images. Also when i want to rearrange the items in ListBox2 it duplicates without deleting the previous one. Or if it's possible I would love to know how to move items from ListBox1 to ListBox2 with just a double Click no need to the drag and drop. I am using the 10.2 version Here is my code and i would appreciate if anyone can help me : type TListBoxItem = class(FMX

How to display XML in a listbox and pass it to a textbox in C#?

烈酒焚心 提交于 2019-12-13 08:36:34
问题 I'm struggling to make a basic C# app that gets a number of items from an XML file, shows the "title" node in a listbox, and, when a title is selected, displays the other nodes of the item in a textbox. The textbox is meant to allow the user to edit the XML content and save the changes. My problem is quite basic I think: The listbox works fine, but the textbox isn't updated when a new title is selected in the listbox. I guess it shouldn't be too complicated, but to me it is - I'm really stuck