listbox

WPF Listbox binding

谁说胖子不能爱 提交于 2019-12-07 11:13:10
问题 I have a physician object, and one of its properties is an ObservableList of clinics. It is being used in a window to show the details of a physician. I can get individual properties to bind to TextBox and ComboBox controls, but I can't get the list of clinics to bind to my ListBox . Here is the xaml for my ListBox : <ListBox Height="318" HorizontalAlignment="Left" Margin="422,0,0,0" Name="lbClinic" VerticalAlignment="Top" Width="158" SelectedValue="{Binding ClinicID, Path=Clinics, Mode

How to add Autoscroll on insert in Tkinter Listbox?

人走茶凉 提交于 2019-12-07 10:42:27
问题 I'm using a listbox (with scrollbar) for logging: self.listbox_log = Tkinter.Listbox(root, height = 5, width = 0,) self.scrollbar_log = Tkinter.Scrollbar(root,) self.listbox_log.configure(yscrollcommand = self.scrollbar_log.set) self.scrollbar_log.configure(command = self.listbox_log.yview) Now, when I do: self.listbox_log.insert(END,str) I want the inserted element to be selected. I've tried: self.listbox_log.selection_anchor(END) but that doesn't work... Please suggest a solution... 回答1:

How to add padding between items in a listbox?

元气小坏坏 提交于 2019-12-07 10:26:50
问题 I'm wondering if there's a way to add padding between my line items. It's a form intended to be used on a tablet, and space between each one would make it easier to select different items. Anyone know how I can do this? 回答1: There is an ItemHeight property. You have to change DrawMode property to OwnerDrawFixed to use custom ItemHeight . When you use DrawMode.OwnerDrawFixed you have to paint/draw items "manually". Here is an example: Combobox appearance Code from link above (written/provided

ZK window not unique in ID space

戏子无情 提交于 2019-12-07 10:13:44
问题 In our project we use ZK for webpages. There is a combobox which has lists. When selected, it fetches data from a java object through onSelect , i have given the logic. when i select one there are 4 listboxes on that page to be filled with data according to the selection. when i select first time, no problem occurs. But on second time i get an error pop-up like "Not Unique in the id space of Window" and showing the list box item id which have to be filled on select. Can any one help out there

WPF ListBox Trigger not working for IsFocused Property

主宰稳场 提交于 2019-12-07 09:01:00
问题 I want to style my ListBox and display a Border around it. I want to hide this Border when ListBox gets focus: <Trigger Property="IsFocused" Value="True"> <Setter Property="Visibility" TargetName="border" Value="Collapsed"/> </Trigger> Same thing I'm using in TextBox also and it is working properly. Why is this Trigger not working for ListBox ? Edit: I am having this Style for my ListBox : <ControlTemplate TargetType="{x:Type local:ListBox}"> <Border SnapsToDevicePixels="true" x:Name="Bd"

how to add tooltips on winform list box items

不羁的心 提交于 2019-12-07 08:44:15
问题 I am using win form's list box control. I want to add tool tips on list items. I could not find any default such properties. Please share me , how can i add tool tips on winform list box items ? Thank You 回答1: If you want to do it in a listbox you will need to do it manually. Add a tooltip to the form and update the tooltip based on the mouses postion. An easier way to do this might be to use a DataGridView control like this: DataGridView1.RowHeadersVisible = False DataGridView1

Loading a listbox from a file

徘徊边缘 提交于 2019-12-07 08:35:32
This is my first time creating a C# program so I apologize if this question seems basic. I have 3 list boxes on my design form along with 3 buttons I'd like to load a list of item into each text box when I click the corresponding button for the listbox. can someone instruct me on how to do this. Abbas has given you a sufficient answer, but there are a couple of problems with it, so I thought I would add my own response. The issues: Streams (anything that implements IDisposable ) need to be closed after you're done with them. You can do this by manually calling Dispose() or by wrapping the

How to ensure that no item is selected in databound ListBox?

时光怂恿深爱的人放手 提交于 2019-12-07 07:56:49
问题 OK, this must be a duplicate question, but I cannot find the answer: I have a listbox that is databound to a Collection. By default Items[0] is selected. How can I prevent this in order to ensure that the SelectionChanged event is raised any time I click a ListBoxItem? EDIT: I had already dismissed the SelectedIndex=-1 route, but I tried again: Setting the SelectedIndex to -1 in the Listbox's constructor (or as an attribute in XAML) does not work. It seems that the listbox is populated after

Add image to listbox

人走茶凉 提交于 2019-12-07 07:33:48
问题 I have a few images with some text, I need to show the image with the relevant text in a listbox. Browsing google I came across this sample class, public class Customer { public string Fname; public string Lname; public Customer(string firstName, string lastName) { Fname = firstName; Lname = lastName; } public override string ToString() { return Fname + " " + Lname; } } lstCustomers.Items.Add(new Customer("Foo","Bar")); The above code works fine as it only returns string, how do I return an

WPF ListBox SelectionChanged event

被刻印的时光 ゝ 提交于 2019-12-07 06:38:19
问题 I have a problem with listbox. When in my program I click on one ListBoxItem, I want to change/open the window and preorder it before. But the problem is that it firstly fires the event and then it changes selection. Code: private void LB_Playlist_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (LB_Playlist.SelectedItem != null) { try { List<string> _tempList = new List<string>(); File_Load_List(LB_Playlist.SelectedItem.ToString(), _tempList); LoadListIntoBox(_tempList); G