listbox

Loop through the second column of WPF ListView and retrieve value of ComboBox in each row

馋奶兔 提交于 2019-12-13 04:45:10
问题 I have a two-column ListView with CheckBoxes in the first column and ComboBoxes in the second column. I need to loop through the ComoboBoxes in the second column and retrieve the selected values (or indexes) from each ComboBox, along with some index or identifier of the ComboBox, and put the values in an array. For example, the layout looks like this: COLUMN 1 COLUMN 2 ======== ======== ChBx 1 Combo1 ChBx 2 Combo2 I need to grab the SelectedValue or SelectedIndex of each ComboBox in the

Allowing item selection indicator in ListBox to overlay all items in Silverlight

一个人想着一个人 提交于 2019-12-13 04:39:54
问题 I have a ListBox that uses a WrapPanel for its ItemsPanel , a custom ItemTemplate , and a custom ItemContainerStyle . The ItemContainerStyle's template contains a selection box that shows up when an item is selected. The graphics designer would like this selection box to overlap sibling items in the ListBox like it's an overlay. The first thing I tried was setting the Canvas.ZIndex property of the ItemContainer in the Selected state. That did not seem to have an effect. Then I read that list

How do you bind a ListBox's SelectedItem to another ListBox's SelectedItem's property?

扶醉桌前 提交于 2019-12-13 04:38:24
问题 I have a ListBox in my UI that is bound to List<Notification> Notifications { get; set; } : <ListBox ItemsSource="{Binding Notifications}" DisplayMemberPath="ServiceAddress" Name="NotificationsList"/> A Notification has a filter title associated with it: public class Notification { public string FilterTitle { get; set; } public string ServiceAddress { get; set; } } My UI has another ListBox that is bound to List<LogFilter> Filters { get; set; } : <ListBox ItemsSource="{Binding Filters}"

How to bind the viewModel to view

被刻印的时光 ゝ 提交于 2019-12-13 04:37:09
问题 I have created WPF code in the main window ,now I want to use MVVM. I have copied all the data from the xaml of the main window to user control and created new class on the view model folder with the code which is in the xaml.cs class in the user control class I add public UserControl() { InitializeComponent(); this.DataContext = new ModelView(); } currently there is two issue 1.In the main window I refer to ListBox as showen below ,and now probably the user control doesn't know about it,how

Grief with WPF UserControl with ListBox and TextBox Can't get textwrapping to work

拜拜、爱过 提交于 2019-12-13 04:36:01
问题 I am trying to produce a simple User Control that allows a user to enter notes and review the notes he or she has taken. For now, I have a ListBox to show previous notes and a TextBox to enter a new note. The ListBox also uses TextBoxs to show the individual notes. The logic is all working. Now I'd just like the control to look a little nicer. I am not seeing text wrapping when one of the notes is long. Nor am I seeing text wrapping on the TextBox where I enter a new note. I have tried to

Copy items from CheckedListBox to ListBox

谁说我不能喝 提交于 2019-12-13 04:29:07
问题 I'm trying to copy the CheckedItems from a CheckedListBox to a Listbox , but I am not getting it right. I have tried Listbox.Items.Add(checkedlistbox.CheckedItems); but that only gives me a (collection) Does anyone have a great line of code to share? :D 回答1: This should work: foreach(var Item in checkedlistbox.CheckedItems) Listbox.Items.Add(Item); Edit: replaced string with var so it works with non-string types too. 回答2: string item = checkedListBox1.SelectedItem.ToString(); if (e.NewValue =

ListBox with overriden CreateParams doesn't raise item events

浪尽此生 提交于 2019-12-13 04:28:12
问题 I've created a custom ListBox like in here. Thing is it doesn't raise any of the item specific events like DrawItem and SelectedIndexChanged. Any idea why? Thanks. 回答1: It worked just fine when I tried this code: public partial class Form1 : Form { MyListBox mList; public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { mList = new MyListBox(this); mList.Location = new Point(5, 10); mList.Size = new Size(50, this.ClientSize.Height + 50); for (int ix = 0; ix <

Binding Listbox to bindinglist, filter on item property

我的未来我决定 提交于 2019-12-13 04:27:41
问题 I'm working on a Winforms application and I have a bindinglist of objects that I want to bind to a listbox. I got this to work, but what I want to do next, is only display items where a particular property is true. So I have a class with a bindinglist class DataBuilder { public BindingList<TableSet> allTableSets = new BindingList<TableSet>(); } And a class TableSet with some properties class TableSet { public string TableSetName {get; set;} public bool IsPopulated {get; set;} } And now on my

Windows Phone - ListBox with Tiles and ContextMenu, IsEnabled binding does not work

≡放荡痞女 提交于 2019-12-13 04:24:37
问题 I have a ListBox (binds to an observable collection) and each item is displayed as tile. The style for the ListBoxItems is defined in my App.xaml and linked with the property ItemContainerStyle. I want to display a ContextMenu for each tile with one MenuItem "Pin to Start". This does work, but the MenuItem is still enabled although I bind the IsEnabled property to ViewModel property which returns false. If I set the IsEnabled property to false in my XAML code (without binding), I have the

Set new focused item in a List Box

℡╲_俬逩灬. 提交于 2019-12-13 04:24:16
问题 I have a question. Is it true that in Access 2010 we can read which item in a list box has Focus. By focus I mean that little rectangle that is around current item. This is not a selected item. Selected item is highlighted. By clicking on List Box we set focus on an item and also select it. When selection is changed the focus stays there. The property that indicates the index of that item is I believe .ListIndex. I would like to programmatically change it but unfortunately .ListIndex is read