listbox

Winforms listbox not updating when bound data changes

老子叫甜甜 提交于 2019-12-23 10:54:10
问题 The image below shows how my code works. When I press button2 the listbox is updated, but not when I press button1. Why? Is the problem threading related? If it is, where should I add the call to (Begin)Invoke? One interesting thing to note is that if I first press button1 and then button2 the data generated by the button1 click is shown when I click button2. So it seems like the data generated by doFoo is buffered somewhere, and then pushed to the listbox once I press button2. EDIT: I tried

WPF: Adding an image to a ListBox ItemTemplate

十年热恋 提交于 2019-12-23 09:48:27
问题 I am creating a WPF app with a list box that I am binding to project names. As a decorative element, I want to place a small icon next to each item in the list, similar to the way Outlook does in its Personal Folders list. For starters, I am going to use the same image for all items in the list. Here is the markup that I've got so far (I'll move it to a resource dictionary after it's working): <ListBox.Resources> <ImageBrush x:Key="ProjectIcon" ImageSource="Images/project.png" /> </ListBox

Multiple columns in List box control

心已入冬 提交于 2019-12-23 09:34:38
问题 how can i display two columns in a list box? 回答1: A list box wasn't designed to display multi-column data. Even the Windows Forms version doesn't directly support that kind of data display. Your requirements aren't clear, but the simplest way to go would be to use a GridView control. It gives you a lot of functionality out of the box, and you can expand it to more columns very easily. If you need more control over the look or functionality, you can use a DataList instead. To get the scrolling

Listbox IsSynchronizedWithCurrentItem causes selection of the first item even though nothing its telling it to do it

荒凉一梦 提交于 2019-12-23 07:59:30
问题 I came across something that maybe a bug in wpf listbox. Please see the code and then I explain what happens Window <Window > <Grid> <local:MultiSelectionComboBox Width="200" MinHeight="25" HorizontalAlignment="Center" VerticalAlignment="Center" ASLDisplayMemberPath="FirstName" ASLSelectedItems="{Binding SelectedModels}" ItemsSource="{Binding Models}" /> <ListBox HorizontalAlignment="Right" VerticalAlignment="Top" DisplayMemberPath="FirstName" ItemsSource="{Binding SelectedModels}" /> </Grid>

“SelectedIndexChanged” not firing after “Items.Clear()” in ListBox

我与影子孤独终老i 提交于 2019-12-23 07:47:15
问题 For a ListBox (With Selection mode set to One), I wish to track whether there's a selected item or none selected. To do so, I subscribed a method to SelectedIndexChanged and checked if the SelectedIndex is -1 or not. However, I noticed that the event doesn't fire after calling Items.Clear(), even though SelectedIndex changes to -1 (if it wasn't already -1). Why doesn't it fire? I know I can work around this by assigning -1 to SelectedIndex before clearing the list. But is there a better way?

How to show multiple Dictionary items in ListBox

谁说我不能喝 提交于 2019-12-23 06:14:30
问题 My code has two ListBoxes ( LeftListBox and RightListBox ) and one TextBox. Those ListBoxes transfer the items between the them. The TextBox shows a number, which corresponds to the SelectedItem in RightListBox (e.g., when T1 is selected, it shows 10 , when T2 is selected, it shows 20 , and so on). I've just made it!! ... but those ListBoxes show only the 1st Dictionary item out of three ... How can I show all of them? Here is my code: MainWindow.xaml <Window x:Class="ListBoxMoveAll

ListView - select index only programmatically

会有一股神秘感。 提交于 2019-12-23 05:26:21
问题 i am trying to implement listbox (or listview): <ListView ItemsSource="{Binding Players}" SelectedIndex="{Binding SelectedIndex}"> My problem is, that i want to bind selected index to property in code-behind. It work only on form start, but i need to disable user to change selection. Selectin will be changed ONLY programmaticaly. Thanks for all advices or solutions :) 回答1: So, working solution: private void playersList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender

horizontal listbox that could be infinite circle scrolling

空扰寡人 提交于 2019-12-23 05:25:06
问题 I would like to make a horizontal listbox that could be infinite scrolling (looping listbox/scrollviewer, or circular listbox/scrollviewer), means that when I scroll to its end, its would scroll over from beginning. I have tried to make the listbox horizontal, but it wouldn't scroll so I put it inside a scrollviewer to have it scroll horizontally. However it's not the listbox that scroll and I need them somehow to scroll over from beginning. This is what I have so far: private void

How to create custom pagination in ZK

时光总嘲笑我的痴心妄想 提交于 2019-12-23 04:59:14
问题 I could not find any tutorial regarding custom pagination in zk. ZK provides it's default pagination and it's quite good but my customer needs different pagination style. So, how can I create custom pagination in ZK. Any help please ? I have a listbox like this : <listbox id=”bidLbx” mold=”paging”> <listitem> ... </listitem> </listbox> It displays ZK's default pagination like: 1 2 3 4 5 Next Last but with out option to select per page row number. So, I need my own Buttons and per page

Multiple selection listbox of State not displaying all Cities in another listbox(Php,mysql,ajax)

只愿长相守 提交于 2019-12-23 04:55:11
问题 Selecting the Country dropdown displays State listbox with multiple selections without refreshing page . But selecting 2 or 3 States not displaying all cities in another lisbox. Cities are displaying for only one State. help loadData.php <?php $q = $_GET['q']; $con = mysqli_connect('localhost','root','','test'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"test"); $sql="SELECT * FROM state WHERE country_id = '".$q."'"; $result = mysqli_query($con,$sql