listbox

Listbox drag-reorder : Index of the dropped item

时光毁灭记忆、已成空白 提交于 2019-11-30 00:21:39
问题 I'm using a Listbox wrapped inside a ListBoxDragDropTarget (from the Silverlight toolkit). This ListBox ca be manually reordered by the user. However the last item must always be located at the bottom of the ListBox , and can't be moved at all. I found a way to cancel this last item moves, but if I drag and drop another item below this last item, it gets moved. I can find the index of the dragged item using this code in the Drop event of the ListBox: object data = e.Data.GetData(e.Data

TwoWay Manual Binding Implementation for ListBox.SelectedItems?

怎甘沉沦 提交于 2019-11-29 23:10:57
I've been trying to see if there is an easy/clever way to implement binding to ListBox.SelectedItems. If you have tried yourself, you will know, that markup binding using BindingExtension will not work - the property doesn't support it. So you are left with wiring up a handler for SelectionChanged and trying that route. The closest I've gotten is this post: http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry Update: the above mentioned blog is no longer available, that author's current blog is here and the closest I could find to the referenced blog post is this StackOverflow

How can I disable horizontal scrolling in a WPF ListBox?

六月ゝ 毕业季﹏ 提交于 2019-11-29 21:58:55
This seems to be an absurdly simple question but Google and Stack Overflow searches yield nothing. How can I disable horizontal scrolling in a WPF ListBox when items take up more horizontal space than is available in the box? Jason Anderson In XAML: <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" /> In C#: myListBox.SetValue( ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled); 来源: https://stackoverflow.com/questions/373778/how-can-i-disable-horizontal-scrolling-in-a-wpf-listbox

WPF Listbox Show Button in ItemTemplate on MouseOver

别等时光非礼了梦想. 提交于 2019-11-29 20:26:10
I have a listbox containing and image and a button. By default the button is hidden. I want to make the button visible whenever I hover over an item in the listbox. The XAML I am using is below. Thanks <Window.Resources> <Style TargetType="{x:Type ListBox}"> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> <Border BorderBrush="Black" BorderThickness="1" Margin="6"> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Path=FullPath}" Height="150" Width="150"/> <Button x:Name="sideButton" Width="20" Visibility="Hidden"/> </StackPanel> </Border> </DataTemplate> </Setter

ListBox item load animation

时间秒杀一切 提交于 2019-11-29 19:49:35
问题 I want to create user control based on ListBox (ListView) with such animation: the items in listbox do not loads all at once, they have to load step-by-step (item-by-item, first then second, then third, etc.) with some timeout between them. How can I do that? 回答1: You could use a Blend SDK behavior for this: <ListBox ItemsSource="{Binding Collection, Source={StaticResource SampleData}}"> <i:Interaction.Behaviors> <b:FadeAnimateItemsBehavior Tick="0:0:0.05"> <b:FadeAnimateItemsBehavior

How to see if a widget exists in Tkinter?

送分小仙女□ 提交于 2019-11-29 19:19:49
问题 Now, I know that you can check to see if a window exists by: x.winfo_exists() Which returns a Boolean. Now I have searched but haven't been able to find exactly what I need. More specifically I need to check the existence of my buttons, labels, list boxes, sliders etc. 回答1: winfo_exists returns 1 unless you have destroyed the widget, in which case it returns 0. This method can be called on any widget class, not only the Tk root or Toplevels. Alternatively, you can get all the children of a

WPF ListBoxItems with DataTemplates - How do I reference the CLR Object bound to ListBoxItem from within the DataTemplate?

£可爱£侵袭症+ 提交于 2019-11-29 18:48:54
问题 I have a ListBox, that's bound to an ObservableCollection . Each ListBoxItem is displayed with a DataTemplate . I have a button in my DataTemplate , that when clicked, needs a reference to the member of the ObservableCollection it's part of the DataTemplate for. I can't use the ListBox.SelectedItem property because the item does not become selected when clicking the button. So either: I need to figure out how to properly set ListBox.SelectedItem when the mouse hovers, or when the button is

WPF Listbox and Select All

梦想与她 提交于 2019-11-29 17:36:52
问题 I want to create a simple ListBox and have SelectAll as a context menu item. However it seems that ListBox has some sort of inbuilt handling for SelectAll that I can't get working, but is interfering with my attempt to implement SelectAll. My entire XAML is this: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.CommandBindings>

listbox selected item give me “ System.Data.DataRowView” , C# winforms

点点圈 提交于 2019-11-29 17:32:59
I have listbox1 - its datasource is a column (productname). so i have in the listbox a MultiSelection option. and im trying to make a MessageBox for all the option i selected and this the code: foreach (object selectedItem in listBox1.SelectedItems) { MessageBox.Show((selectedItem.ToString() + Environment.NewLine)); } the problem is that im getting this value instead System.Data.DataRowView Chris How do you populate the listbox (ie what is exactly the datasource)? From your comment I would say a DataView (and wich contains DataRowView...) So you just need to cast the SelectedItem into

Categorize Listbox items by Color

别等时光非礼了梦想. 提交于 2019-11-29 16:59:57
So I'm trying to make a listbox with 2 buttons. Listbox is supposed to display files from a specific folder (I get back to this) And the two buttons are supposed to be called "Set.." (As in set directory) and Update (As the list will be refreshed (Something I do every time the Windows Form Runs. So as of now, when I start my application, and go to the form with the listbox, the listbox is empty. When pressing "Update", the List box picks up files from an address located on my Harddrive (So this is a static address located in my code). It also finds 7 different extensions (Filetypes), and lists