listbox

KeyDown event is not working for Arrow keys, Home, End, PageUp, PageDown and other similar keys in silverlight

。_饼干妹妹 提交于 2019-12-08 07:32:54
问题 I want to override the selection behavior of ListBox Items. We can traverse through ListBox items using Up and Down arrows but I want to traverse the list using Left and Right arrow keys. While I am trying to add the key down event for ListBox, It shows almost all key presses except for Arrow Keys, Home, End and similar keys. I have the following code: private void listArtist_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key.ToString() == "Enter") { // Go to some page }

Add multiple items to a listbox on the same line

ぐ巨炮叔叔 提交于 2019-12-08 07:08:21
问题 Hey guys, i figured out how to add items to a listbox one line at a time: try { if (nameTxtbox.Text == "") throw new Exception(); listBox1.Items.Add(nameTxtbox.Text); nameTxtbox.Text = ""; textBox1.Text = ""; nameTxtbox.Focus(); } catch(Exception err) { MessageBox.Show(err.Message, "Enter something into the txtbox", MessageBoxButtons.OK, MessageBoxIcon.Error); } But I wont to be able to add multiple items to the same line. Like have first_name | last_name | DoB all on the same line. When I do

How to disable Virtualizing for lisbox item Wp8

霸气de小男生 提交于 2019-12-08 07:00:41
问题 I am not able to disable the Virtualizing property under VirtualizingStackPanel for listbox .I am only getting VirtualizationMode property. Actually i need to get checkbox element under listbox.Tried several methods but most appropriate ans i got here but i was getting ItemContainerGenerator as null. After more rnd i found that i need to set IsVirtualizing=false to get the ItemContainerGenerator . xaml is :: <ListBox x:Name="my_list" Grid.Row="0"> <ItemsControl.ItemTemplate > <DataTemplate >

Move elements from a listbox to another

我与影子孤独终老i 提交于 2019-12-08 06:56:34
问题 Good day to all. I need to do this. I have 2 listboxes and when a button is pressed I need to move an option from one to another. I did this: html: <table border="1" cellpadding="5"> <tr> <td> Un-Selected <br /> <select multiple="multiple" id="selectBoxOne" size="5" class="selectListBox"> <option value="0" id="multiple0">Option 0</option> <option value="1" id="multiple1">Option 1</option> <option value="2" id="multiple2">Option 2</option> <option value="3" id="multiple3">Option 3</option>

Delete Selected File from Listbox and Folder

点点圈 提交于 2019-12-08 05:33:42
问题 I want to Delete the Selected File from Listbox and Folder. For now it's only removing it from the Listbox. Now I want it to be removed also from the Folder. Thanks private void tDeletebtn_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) listBox1.Items.RemoveAt(listBox1.SelectedIndex); } private void TeacherForm_Load(object sender, EventArgs e) { DirectoryInfo dinfo = new DirectoryInfo(@"data\\Teachers\\"); FileInfo[] Files = dinfo.GetFiles("*.xml"); foreach (FileInfo

WPF - Retrieve Child DataTemplate Control From Custom ListBoxItem

断了今生、忘了曾经 提交于 2019-12-08 05:23:20
问题 In my application, I have a ListBox with a custom DataTemplate. The XAML is as follows: <ListBox Name="lstTasks"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> <CheckBox Name="chkIsChecked" VerticalAlignment="Top" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}"/> <RichTextBox Name="rtbTask" HorizontalAlignment="Left" Height="50" VerticalAlignment="Top" Width="450" BorderBrush="{DynamicResource {x:Static SystemColors

bind listbox to index C#

瘦欲@ 提交于 2019-12-08 04:44:50
问题 I dont know if it possible but what I want is something like that In WinForm listbox1 has a list of lines(copied from file) In another Thread and class I run on a List that contains the same lines each line I parse and DoSomething once I finish with that line I want the index in the listbox to change from my basic and limited understanding my approach was with an Event to fire in form and than maybe using Invoke (for not to cross thread ) Is there is a way to somehow bind to index of the

Tlistbox items from database column

戏子无情 提交于 2019-12-08 03:56:34
问题 Is there a way to populate a TListbox control with items from a database column? I know the proper way to do this is to simply use a DBLookupListbox control and set it up to access the column I want, but the problem with that is when I click on one of the items in the lookup control, it changes the current row in the dataset (expected behavior) but I do not want this to happen. Instead, I would want the current row to be changed only on a double click event in the lookup control and since I

WPF - Retrieve Child DataTemplate Control From Custom ListBoxItem

不问归期 提交于 2019-12-08 03:54:40
In my application, I have a ListBox with a custom DataTemplate. The XAML is as follows: <ListBox Name="lstTasks"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> <CheckBox Name="chkIsChecked" VerticalAlignment="Top" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}"/> <RichTextBox Name="rtbTask" HorizontalAlignment="Left" Height="50" VerticalAlignment="Top" Width="450" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" Margin="0,0,0,10"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I use a

Add userControl to listbox

筅森魡賤 提交于 2019-12-08 03:45:10
问题 I am working on a little project for a contest in my city..and i just hit a brick wall.The thing is: i am creating a userControl in Blend(let's say a canvas,in wich i have a reactangle..a textblock and an image).My problem is that i can not add this to the listboxitem in WPF by code.Addin the userControl one by one in the designer seems to work..but the software is going to work with a variable number of items for the listbox. private void mainPane1_Loaded(object sender, RoutedEventArgs e) {