listbox

Why does binding of my ObservableCollection<string> to Listbox not work?

风流意气都作罢 提交于 2019-12-11 01:04:41
问题 When I update a ObservableCollection<string> and call RaisePropertyChanged(..) somehow its content is not shown within my Listbox in WPF. I have no idea what I am doing wrong. The critical part is where I update the FileNames property: public class HistoricalDataViewRawDataViewModel : ViewModelBase { private string _currentDirectory; private ObservableCollection<string> _fileNames; private List<string> _rawData; public ICommand ChangeDirectoryCommand { get; private set; } public string

Binding a WPF ComboBox to a different ItemsSource within a ListBox DataTemplate

狂风中的少年 提交于 2019-12-11 00:38:36
问题 I have a ListBox that contains a textbox and a combobox in its datatemplate: <ListBox Height="147" Margin="158,29,170,0" Name="PitcherListBox" VerticalAlignment="Top" ItemsSource="{Binding SomeCollectionOfObjects}" Background="Black"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding Path=Name}" /> <ComboBox ItemsSource="{Binding LocalArrayOfIntsProperty}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I want to bind the

How to indicate that a urwid listbox has more items than displayed at the moment?

一曲冷凌霜 提交于 2019-12-11 00:36:44
问题 Is there a way to show a user that a urwid listbox has additional items above / below the dispalyed section? I'm thinking of something like a scrollbar that gives an idea of the number of entries. Or a separate bar at the top / bottom of the list box. If this behavior can not be implemented, what approaches are there to achieve this notification? During my research, I found this question, which tried to achieve eventually the same. The given answer seems to check if all elements are visible.

Remove an item from a list box causes a Catastrophic Failure?

你。 提交于 2019-12-11 00:30:28
问题 I am trying to clear a list box's items in my Windows RT App. To add the items, I use: List<string> list1; ... foreach(string s in list1.Items) { listBox1.Items.Add(s); } To clear the items, I use: listBox1.Items.Clear(); However, this throws this exception: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) If I try to use: int at = 0; while (at < listBox1.Items.Count) { listBox1.Items.RemoveAt(at); at += 1; } I get the same exception at the RemoveAt method. 回答1: I

Some mistake with drag and drop an item from listbox

瘦欲@ 提交于 2019-12-11 00:24:35
问题 I have a ListBox and I want to drag and drop Items on a rectangle. Everything was okay when I had just items instead of ItemsSource and ItemTemplate , but now it's filled from collection. Once I drop it on rectangle I want another TextBox to show value from property "protection" XAML <ListBox x:Name="listhelmets" Height="214" Width="248" ItemsSource="{Binding ListHelmets}" IsSynchronizedWithCurrentItem="True" Canvas.Left="211" Canvas.Top="72" PreviewMouseDown="helmet_MouseDown1"

tkinter listbox drag and drop with python

旧时模样 提交于 2019-12-10 23:49:28
问题 Can anyone point me to where I can find info on making a listbox with the ability to drag and drop items for re-arranging? I've found some related to Perl, but I know nothing of that language and I'm pretty new to tkinter, so it was pretty confusing. I know how to generate listboxes, but I'm not sure how to re-order it through drag and drop. 回答1: Recipe 11.4 at this link shows an example. 回答2: Here is the code from Recipe 11.4: import Tkinter class DragDropListbox(Tkinter.Listbox): """ A

Loading image from projects files

空扰寡人 提交于 2019-12-10 22:29:17
问题 I'm trying to get png image which is my Resource folder. I tested solution that was written here :Add images to ListBox (c#, windows phone 7). For start I wanted to get the same image for every item in my ListBox. But I can't achive that. The picture doesn't show. It's how my list in xaml look like: <ListBox x:Name="ProductList"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}"/> <Image Source="{Binding ImagePath}" Stretch="None"/> </StackPanel> <

Listbox is not Populating using binding

我怕爱的太早我们不能终老 提交于 2019-12-10 22:29:01
问题 I am trying to convert my existing program in c# wpf, using mvvm pattern. The first part is select the Folder location of the files to be process and populate the listbox I found an example here using Mvvm Light: WPF OpenFileDialog with the MVVM pattern? the example in the link above is selecting a Folder. this is the structure of my project this is the code of my FileListView.xaml <UserControl x:Class="MvvmLight1.Views.FilesListView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml

Windows Forms listbox is overflowing when there are too many items to scroll

有些话、适合烂在心里 提交于 2019-12-10 20:35:22
问题 I am building an indexer application based on a suffix tree, that enables me to index whole documents and search strings, substrings, etc, extremely fast. What I'm doing is entering a string in a textbox, pressing a button, and running a function that queries the suffixtree and adds the positions of all occurences of the string to a listbox. So the listbox has a lot of integers inside it. Normally, this works fine. For instance, searching for "wizard" or "Gandalf", or "hobbit" (I am indexing

ListBox Not Selecting the Selected Item

删除回忆录丶 提交于 2019-12-10 19:12:35
问题 See code below Visual Studio 2010 Above the ListBox have a TextBox. Via binding the TextBox can get bigger or smaller when an item is selected. That causes the ListBox to move. When the ListBox moves the selected item is NOT the item that was clicked. The selected item is the item under the mouse on the moved ListBox. Some times it will not even select at all (try and go from 9 to 10 or from 10 to 9). In this code to reproduce the problem even and odd produce different lengths. So if you go