listbox

Get the ListBox row object from a button that is on the DataTemplate

左心房为你撑大大i 提交于 2019-12-11 03:33:26
问题 I have a ListBox with a DataTemplate . The template has a Button on it. When the Button is clicked I want to do some logic with the object that is each row (in this case an object called WorkItemTypeMappings ). In the OnClick how can I go from the Button ( object sender ) to the object that is row that the button is on? Here is the XAML of my ListBox : <ListBox ItemsSource="{Binding Source={StaticResource WorkItemTypeMappingsCollectionView}}" HorizontalContentAlignment="Stretch" ScrollViewer

Windows Phone 7 - Function for ListBox button

二次信任 提交于 2019-12-11 03:29:37
问题 I have list of items in ListBox. All the items have buttons. I want to show the selected items name when I click the button inside the ListBox (Not the list box items). My Xaml:- <ListBox SelectedIndex="{Binding SelectedIndex,Mode=TwoWay}" SelectedItem="{Binding SelectedStudent, Mode=TwoWay}" Height="374" ItemsSource="{Binding StudentDetails,Mode=TwoWay}" HorizontalAlignment="Left" Margin="2,6,0,0" Name="listBox1" VerticalAlignment="Top" Width="476" BorderBrush="#00410D0D"> <i:Interaction

How to load XML “row” into index of listbox C#

戏子无情 提交于 2019-12-11 03:29:28
问题 I'm trying to load a single "row" of xml to a listbox index. <?xml version="1.0" encoding="utf-8"?> <!--User | 4/16/2013 @ 10:05 PM--> <ContactBook> <Contact> <Name> <Name>personName</Name> </Name> <City> <City>testCity</City> </City> <State> <State>testState</State> </State> <Phone> <Phone>testPhone</Phone> </Phone> </Contact> </ContactBook> So I would like to make name, city, state, and phone show up on one line in a listbox, then have the next contact appear in the next listbox row. I

Drop-down menu/ComboBox/listbox in TinyMce 4?

限于喜欢 提交于 2019-12-11 03:26:12
问题 After doing some research in google for pretty long time found some info on Drop down menu , but the documentation doesn't have clear information for me to understand, or other docs are mostly on TinyMce3 . I've customized TinyMce 4 adding a button, menu and sub-menus and have used Window Manager with text box and radio button (which is a checkbox , poor efforts I know), but I need a drop down list/listbox in Window Manager edit : Radio buttons are not supported in tinymce4 回答1: this helped a

Silverlight: Disable UI virtualization?

99封情书 提交于 2019-12-11 03:19:26
问题 Is there a simple way to disable UI virtualization on a ListBox control? I'm attempting to find a control within a ListBox control using the "FindName()" method, but in the case that the control is visibly off of the Web Browser window, it's not finding the control. I'm almost certain the culprit is UI virtualization. As the control is scrolled off the page, it is no longer retrieved successfully via "FindName()". The second I scroll it back onto the screen, it returns the control

Search in A ListBox

旧城冷巷雨未停 提交于 2019-12-11 03:18:01
问题 HI I'm trying to put a textbox to search in a listBox. I have a TextBox: SearchText with this code: private void SearchText_TextChanged(object sender, EventArgs e) { int i = listBox3.FindString(SearchText.Text); listBox3.SelectedIndex = i; } and a ListBox On the Load I have this code List<string> str = GetListOfFiles(@"D:\\Music\\massive attack - collected"); listBox3.DataSource = str; listBox3.DisplayMember = "str"; and on selectedIndexChanged : private void listBox3_SelectedIndexChanged

ListBox.SelectedIndex in ContextMenu event handler

浪子不回头ぞ 提交于 2019-12-11 03:14:38
问题 I have a listbox with context menu. How can I get value of SelectedIndex (SelectedItem) property in ContextMenuItem click event handler? Currently in events Edit_Click and Delete_CLick a value of CarsList.SelectedIndex always is -1. Here my ListBox in XAML: <ListBox Name="CarsList" Style="{StaticResource ListBoxStyle}" Margin="26,0,26,0" Height="380" > <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu Name="ContextMenu" > <toolkit:MenuItem Name="Edit" Header="Edit" Click="Edit

WPF Listbox commands

那年仲夏 提交于 2019-12-11 03:11:05
问题 Ok, my program in a nutshell has a list of customers. Those customers are all listed in a listbox so when one is clicked on all of their information appears on the form. This works through databinding, all of the controls on the page are bound to the listbox's selectedItem. What I would like to do now is have a message dialog that asks if the user would like to save when they try to change the selection. If they don't I want to revert it back to the original item in the collection. If they

WPF ListBox control horizontal scrolling in code

半腔热情 提交于 2019-12-11 02:48:16
问题 How can I set the horizontal scroll position of a list box in code? I have a list box with a wrap panel in the items template and I want to implement a 'page right' function that behaves like a page down down in a normal list but works sideways. Thanks! 回答1: With some more searching around the site, I figured out the answer to my question. Using the following function from Josh G's answer to this question public static childItem FindVisualChild<childItem>(DependencyObject obj) { ... } With

C# MultiColumn Listbox

北城余情 提交于 2019-12-11 02:27:07
问题 I have two the following code List<string> _items = new List<string>(); List<string> _items2 = new List<string>(); I want to add both of them into a single multi-column Listbox Column1 could be _items whereas Column2 can be _items2 I don't know how to add items2 to a 2nd column I've added _items to the Listbox by Listbox1.DataSource = _items Thank you 回答1: The above answer did not work for me, using .NetCF, this slight variation did: myListView.Columns.Add("Nr"); //column 1 heading myListView