listbox

How refresh items of a ListBox? [duplicate]

≡放荡痞女 提交于 2019-12-22 09:48:03
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: C# Force ListBox to update elements Let's consider this small piece of code: listbox.DataSource = base_items; listbox.DisplayMember = "Name"; // ... a bit later in the program base_items.Add( new Base_Item("Unnamed") ); From this point, how do I do to make the listbox update its items? The only way for me to see the update is to close the window and reload it again. 回答1: Just remove and add databinding again.

How to populate listbox dynamically with SQL values

痴心易碎 提交于 2019-12-22 08:42:06
问题 I am a C# beginner. What I am trying to do is pull data from a column in a SQL database and write it to a listbox. Basically, I want the data in the part_num column of my table to be displayed dynamically in the listbox. I have seen: this.listParts.Items.AddRange(new object[] {"Part1", "Part2"}); But how would I go about replacing “Part1” and “Part2” with dynamically generated values from SQL? public mainForm() { InitializeComponent(); SqlConnection conn = new SqlConnection( "Data Source

After rebinding Silverlight Listbox control how do you get it listbox to scroll to back to the top?

这一生的挚爱 提交于 2019-12-22 08:14:10
问题 I have a silverlight listbox that is being used as a search result box. I'm using dynamic searching (keyups in the search box cause the events to fire to filter this list box's contents). The issue I'm running into is if the user scrolls down when the box is unfiltered, then does the search, the rebinding of the listbox does not cause the scroll to go back up to the top making the results look like there is only one value in it. the code I have so far for the listbox is this (This is a

How to make a loading graphic in WPF XAML?

℡╲_俬逩灬. 提交于 2019-12-22 07:00:08
问题 So I have a little WPF XAML that gets the titles of my RSS feed and puts them in a ListBox. However, it takes about 2 seconds to load. How can I have put some kind of AJAXy spinning graphic in the ListBox until the data is there? Here is the code: <Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel> <StackPanel.Resources>

WPF - How do I get an object that is bound to a ListBoxItem back

半腔热情 提交于 2019-12-22 05:51:13
问题 here is what I would like to do. I get a List of objects from a database and bind this list to a ListBox Control. The ListBoxItems consist of a textbox and a button. Here is what I came up with. Up to this point it works as intended. The object has a number of Properties like ID, Name. If I click on the button in the ListBoxItem the Item should be erased from the ListBox and also from the database... <ListBox x:Name="taglistBox"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type

Best Way To Span Multiple Columns in WPF Grid/List?

拈花ヽ惹草 提交于 2019-12-22 05:39:09
问题 I have a custom user control I wrote in WPF to display some data. I want to show this usercontrol in a list, but I also want to provide multiple column headers (matching some properties on the user cotrol) so users can sort on properties contained in the usercontrol. I am not sure the best way to go about this. I currently have a ListBox displaying these user controls, but the ListBox has no header and I can't figure out how to put multiple headers on the ListBox. Ideally I'd like something

wpf Datagrid columns width fail in ListBox

允我心安 提交于 2019-12-22 05:09:30
问题 I have a ListBox that contains items derived from UserControl. The concrete UserControl contains (among others) a DataGrid. Basically I cannot change the concrete UserControl (changes only for testing purpose; its kind of third party). The DataGrid column width of all columns gets broken as soon as one column width is set to "*", which is required to fill the complete space. I can reproduce it with a simplified example (w/o UserControl). So if I add a DataGrid as ListBoxItem, specifying a

How to populate a ListBox with a ADODB.Recordset (Error 91) To Do Autocompletion in Access

一笑奈何 提交于 2019-12-22 05:03:05
问题 I work on an Access DB and I have to use a Datasource connection to a SQL Server. To do that I use the ADODB object with : -ADODB.Connection -ADODB.Recordset Code Up-to-date, following an observation of Ian Kenney Dim cnn As ADODB.Connection Set cnn = New ADODB.Connection Dim rs As ADODB.Recordset cnn.ConnectionString = "driver={SQL Server};provider=SQLOLEDB;server=10.****;uid=****readonly;pwd=****readonly;database=****" cnn.Open Set rs = cnn.Execute("SELECT [MATRI], [NOMPRE] FROM SCHEME_DB

Resize Tkinter Listbox widget when window resizes

岁酱吖の 提交于 2019-12-22 04:05:22
问题 I'm new to Tkinter, and I've got a Listbox widget that I'd like to automatically-resize when changing the main window's size. Essentially I would like to have a fluid height/width Listbox. If someone can point me to some documentation or provide a bit a code / insight, I'd appreciate it. 回答1: You want to read up on the geometry managers pack and grid, which lets you place widgets in a window and specify whether they grow and shrink or not. There's a third geometry manager, place, but it's not

TinyMCE render listbox items as html

↘锁芯ラ 提交于 2019-12-22 04:01:07
问题 I created a TinyMCE plugin and need the listbox items to display html. This is my plugin: editor.addButton('icons', { title: 'Foo', text: 'Foo', type: 'button', onclick: function() { editor.windowManager.open({ title: 'Foo', width: 300, height: 200, body: [{ type: 'listbox', label: 'Foo', name: 'foo', values: [{ title: '<em>Foo</em>', // <-- Mark save. Render as html. value: 1 }], }], }); } }); See also the fiddle: http://jsfiddle.net/allcaps/vqctac3d/ But the output looks like: Expected: How