listbox

Bind listbox in WPF with grouping

北慕城南 提交于 2019-12-03 22:04:27
I've got a collection of ViewModels and want to bind a ListBox to them. Doing some investigation I found this . So my ViewModel look like this (Pseudo Code) interface IItemViewModel { string DisplayName { get; } } class AViewModel : IItemViewModel { string DisplayName { return "foo"; } } class BViewModel : IItemViewModel { string DisplayName { return "foo"; } } class ParentViewModel { IEnumerable<IItemViewModel> Items { get { return new IItemViewModel[] { new AItemViewModel(), new BItemViewModel() } } } } class GroupViewModel { static readonly GroupViewModel GroupA = new GroupViewModel(0);

How to use thread Delphi [closed]

一个人想着一个人 提交于 2019-12-03 21:10:46
I work for a few days of this application. Form freezes until the entire transaction. How do I use Tread? procedure TForm1.ListBox1Click(Sender: TObject); var I: Integer; S: String; begin I := Listbox1.ItemIndex; if I <> -1 then begin S := Listbox1.Items[I]; IdHTTP1.ProxyParams.ProxyServer := Fetch(S, ':'); IdHTTP1.ProxyParams.ProxyPort := StrToInt(S); try IdHTTP1.ReadTimeout:=strtoint(form1.ComboBox1.Text); // ZMAAN AŞIMI IdHTTP1.Get(Edit4.Text); // POST GET Memo1.Lines.Add(Format('Sıra %d %s', [I, 'Bağlandı.'])); except Memo1.Lines.Add(Format('Sıra %d %s', [I, 'Bağlanamadı.'])); IdHTTP1

How to implement Hold in Listbox?

放肆的年华 提交于 2019-12-03 21:10:27
问题 If hold the listbox, I want to get listbox index. This is my code: <ListBox Margin="0,0,-12,0" Hold="holdlistbox" x:Name="listbox" SelectionChanged="listbox_SelectionChanged" SelectedIndex="-1"> </ListBox> private void holdlistbox(object sender, System.Windows.Input.GestureEventArgs e) { //How to get ListBox index here } If anyone knows help me to do this. 回答1: e.OriginalSource will get you the actual control that was held (the top-most control directly under your finger). Depending on your

Lazy loading images in Virtualized Listbox

浪子不回头ぞ 提交于 2019-12-03 20:28:12
问题 I'm trying to lazy load thumbnail image for each item in a Listbox asynchronously. <Image Source="{Binding Path=Thumbnail, TargetNullValue={StaticResource DefaultImage}}"/> Since Listbox is virtualized Thumbnail property's getter is called only when an item is in display port or near to that. public BitmapSource Thumbnail { get { TriggerLoad(); return _thumbnail; } } I am awaiting on expensive operation that loads Thumbail in TriggerLoad function, but UI isn't very responsive especially when

WPF Memory Usage

女生的网名这么多〃 提交于 2019-12-03 17:49:58
问题 Application: WPF Application consisting of a textbox on top and a listbox below Users type a string in the TextBox to find employees, and search results are displayed in the ListBox ListBox uses DataTemplates to display elements (shows employee name, department, phone and a thumbnail picture.) Implementation: At application startup I query the database and retrieve all employees and related information to be shown in the ListBox. This is kept in memory the entire time. After application

C# Searching a listBox

流过昼夜 提交于 2019-12-03 17:27:50
I have a large amount of items in a listBox called listBox1. I also have a textBox (textBox1) at the top. I want to be able to type into the textBox and the listBox searches through it's item's and finds ones that contain what I am typing. For example, say the listBox contains "Cat" "Dog" "Carrot" and "Brocolli" If I start typing the letter C, then I want it to show both Cat and Carrot, when I type a it should keep showing them both, but when I add an r it should remove Cat from the list. Is there anyway to do this? Filter the listbox. Try this: List<string> items = new List<string>(); private

Get all selected items from asp.net ListBox

别说谁变了你拦得住时间么 提交于 2019-12-03 17:13:05
问题 Anyone know of a smooth way to get all of the selected items in a listbox control by using extension methods? And, please, spare me the argument of it's irrelevant as to how one gets such a list because in the end everything uses a loop to iterate over the items and find the selected ones anyway . 回答1: var selected = yourListBox.Items.GetSelectedItems(); //var selected = yourDropDownList.Items.GetSelectedItems(); //var selected = yourCheckBoxList.Items.GetSelectedItems(); //var selected =

IPhone like scrolling on Silverlight ListBox

倖福魔咒の 提交于 2019-12-03 16:42:28
I need a listbox with IPhone-like functionality for Silverlight. That is, animated scrolling, and click and drag to scroll. Scrolling will continue a bit after the mouse up event based on the "speed" of the dragging. I've search and found no control vendors providing this. So question is how should I build it? I need some hints to get started. There's two parts to this question: Part 1, How to get the animated scrolling of the listbox. Part 2, How to build a "draggable" scrolling, I guess I should put a canvas on top and track the mouseevent, and simulate some physics. Some hints here would

How to get listbox selected item value

瘦欲@ 提交于 2019-12-03 15:51:42
I am working with C# .NET 4.0 I am trying to get the value of a single selected item in a listbox. This is how I populate the control: this.files_lb.DataSource = DataTable object In my designer, I have specified file_name as the DisplayMember and file_id as the DisplayValue After selecting an item in the listbox, I tried the following to get the value: this.files_lb.SelectedValue.ToString() But all it returns is "System.Data.DataRowView". At this link : Getting value of selected item in list box as string someone suggested - String SelectedItem = listBox1.SelectedItem.Value However, 'Value' is

Get items from listbox in controller MVC ASP 4

时间秒杀一切 提交于 2019-12-03 15:33:21
I have a page where you can create channels. Channels have genres associated with them. CreateChannel.cshtml <h2>Create Channel</h2> <div class="row-fluid"> <div> @{ using (Html.BeginForm("CreateNewChannel", "Channel", new { channelId = Model.Id, userId = @Session["userId"] }, FormMethod.Post)) { @Html.HiddenFor(model => model.Id) <h5>Name</h5> @Html.TextBoxFor(model => model.Name, new { @class = "input-block-level pull-left", type = "text", required = "required", placeholder = "Channel Name", style = "width: 400px" }) @Html.ValidationMessageFor(model => model.Name, null, new { @class = "txt