listboxitems

Drag and Drop a Folder from Windows Explorer to listBox in C#

两盒软妹~` 提交于 2019-12-03 12:40:02
I succeeded in developing C# code for drag files from windows explorer to listBox. // Drag and Drop Files to Listbox private void listBox1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop, false)) e.Effect = DragDropEffects.All; else e.Effect = DragDropEffects.None; } private void listBox1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string fileName in files) { listBox1.Items.Add(fileName); } } If I drag a folder to the listBox, all the files which are inside the folder to

WPF/C# Binding custom object list data to a ListBox?

偶尔善良 提交于 2019-12-03 01:24:10
I've ran into a bit of a wall with being able to bind data of my custom object list to a ListBox in WPF. This is the custom object: public class FileItem { public string Name { get; set; } public string Path { get; set; } } And this is the list: private List<FileItem> folder = new List<FileItem>(); public List<FileItem> Folder { get { return folder; } } The list gets populated and maintained by a FileSystemWatcher as files get moved around, deleted, renamed, etc. All the list does is keeps tracks of names and paths. Here's what I have in the MainWindow code-behind file (it's hard coded for

ListBox items change after doing scroll in Firemonkey

*爱你&永不变心* 提交于 2019-12-01 12:54:14
I am developing a Multi-Device Application in Firemonkey where Main class has a ListBox component with some items. Each of these items has the same custom style. My problem is when I have so many items in the ListBox and I have to do scroll vertical to see the rest of items. In this case, the ListBox has a strange behaviour and when I do scroll up after doing scroll down the item's components (a button for example) have changed his background colour and the items have changed his order inside ListBox. For example, if I had: Item 1 Item 2 Item 3 after I do scroll I have: Item 2 Item 3 Item 1

ListBox items change after doing scroll in Firemonkey

对着背影说爱祢 提交于 2019-12-01 10:39:15
问题 I am developing a Multi-Device Application in Firemonkey where Main class has a ListBox component with some items. Each of these items has the same custom style. My problem is when I have so many items in the ListBox and I have to do scroll vertical to see the rest of items. In this case, the ListBox has a strange behaviour and when I do scroll up after doing scroll down the item's components (a button for example) have changed his background colour and the items have changed his order inside

c# wpf - cannot set both DisplayMemberPath and ItemTemplate

三世轮回 提交于 2019-11-30 20:09:10
I want to add tooltip in listboxItem but it starts problem when there is DisplayMemberPath. Error message said: cannot set both DisplayMemberPath and ItemTemplate. When I removed DisplayMemberPath, tooltip in each list item is working. But i dont want to remove DisplayMemember because i need it. How to solve this problem? <ListBox x:Name="lstToys" Style="{DynamicResource ListBoxStyle1}" ItemsSource="{Binding Strings}" DisplayMemberPath="Toys" MouseDoubleClick="lstToys_MouseDoubleClick"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}" ToolTip="Here is a tooltip"/> <

c# wpf - cannot set both DisplayMemberPath and ItemTemplate

天涯浪子 提交于 2019-11-30 04:20:26
问题 I want to add tooltip in listboxItem but it starts problem when there is DisplayMemberPath. Error message said: cannot set both DisplayMemberPath and ItemTemplate. When I removed DisplayMemberPath, tooltip in each list item is working. But i dont want to remove DisplayMemember because i need it. How to solve this problem? <ListBox x:Name="lstToys" Style="{DynamicResource ListBoxStyle1}" ItemsSource="{Binding Strings}" DisplayMemberPath="Toys" MouseDoubleClick="lstToys_MouseDoubleClick">