listbox

VBA Refresh UserForm ListBox Data when source changes

心已入冬 提交于 2019-12-07 16:10:48
问题 Hi I have encountered problem with my listbox data in my Userform When I try to change the source file where my listbox connected it doesn't seems to change It was showing good data at first but when I try to click RUN DATE button It doesn't go with the Value in my Range that is being set as My key for sorting Here is my code for RUN DATE BUTTON for sorting Ascending and Descending Private Sub CommandButton1_Click() Application.EnableEvents = False Worksheets("combobox_value").Activate Dim

How to create a single select list box that shows the selection using Razor

≡放荡痞女 提交于 2019-12-07 15:41:26
问题 How do I create a simple, single select list box using the Razor view engine? I'm currently running into two problems. The first is that the list box "Select" code generated has 'multiple' automatically added. Question One is how to turn that off. No, I don't want to have to use a drop down list box. Question Two is trickier. The generated "Select" in the output html does not show any items as being selected, despite the item in question have selected values. Here's my code: Object model:

How can I get the last selected value in a ListBox with jQuery?

血红的双手。 提交于 2019-12-07 15:32:40
问题 I have a listbox and I must limit its selection up to 5 items. If a 6th item is selected, I want to "deselect" it. But, I'm having some problems on finding the last selected item and "deselect" it. And the last item selected it's necessary the $("#mySelect option:last")... How can I get the selected item of a listbox?? Thanks!!! 回答1: This will do it, although there is a brief "flash" of selection (you might want ot have a <span> show up underneath the <select> to say something like Maximum

WPF Listbox grouping

随声附和 提交于 2019-12-07 15:15:52
问题 I need to display in the list box like below. The scenario is it will have multiple groups followed by items with alignment horizontally. GroupA GroupA Description GroupB GroupB Description Items Available ItemA ItemB ITemC 回答1: You can try with this code <Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Expander Header="{Binding ....}" IsExpanded="True"> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter

WPF ListBox using ItemsSource and ItemTemplate

爷,独闯天下 提交于 2019-12-07 14:35:50
问题 I'm confused as to how bindings are resolved when I have both an ItemsSource and an ItemTemplate in a WPF ListBox . I have an ObservableCollection<int> called ListOfIndexes . For each index, I want to look up its record in a database table. I hope to do that in the IndexToObjectDescriptionConverter . <ListBox ItemsSource="{Binding ListOfIndexes}" ItemTemplate="{Binding Converter={StaticResource IndexToObjectDescriptionConverter}}" /> But a breakpoint in the converter is telling me that the

Change Background Color of SelectedItem in ListBox in .NET 4.5 WPF

霸气de小男生 提交于 2019-12-07 14:15:00
问题 I want to change the background color of a ListBox's SelectedItem. I tried the below code : <ListBox Grid.Column="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ItemsSource="{Binding Parents}" DisplayMemberPath="Title" Height="35" FontSize="18" BorderThickness="0" Background="#FF2A2A2A" Foreground="White" SelectedIndex="0"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel IsItemsHost="True" Orientation="Horizontal"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox

ListBox, list of different objects implementing the same interface

孤街浪徒 提交于 2019-12-07 13:03:00
问题 I have two objects: User and Client, both implements interface IMember interface IMember { int Id { get; set; } string Name { get; set; } } In a form I set ListBox data source: myListBox.DisplayMember = "Name"; myListBox.ValueMember = "Id"; myListBox.DataSource = membersList; // List<IMember> And wierd things happen ;) When I run program the first object, whichis type of User, displays correctly (Adrian Serafin) and other objects, wich are type of Contact are displayed like this: MyProject

rename an item in listbox

て烟熏妆下的殇ゞ 提交于 2019-12-07 13:01:13
问题 I want to rename selected item in listbox. How to I can do this? Thanks. 回答1: Edit: Revisiting this quite a few years later; below are the ways you can do this dependent on the UI framework you are using. This carries the assumption that you'd like to change the selected text. ASP.Net WebForms protected void ChangeListBoxSelectedItemText(string textToChangeTo) { lstBoxExample.SelectedItem.Text = textToChangeTo; } WPF - Assuming the ListBox contains Label objects // To achieve this in WPF you

WPF. ListBox. How to limit maximum of selected items to 2?

一世执手 提交于 2019-12-07 12:51:53
问题 I need to limit the number of selected items in a ListBox to 2. How to do this? Is it possible to avoid the usage of events and do this in XAML? 回答1: There's no built-in way to do this as far as I'm aware, so you're going to have to write some code. You could set your ListBox as multi-select by setting SelectionMode to Multiple or Extended (See here for the difference) and attach onto the SelectionChanged event. When the event is raised, modify the selection how you see fit (how you do it

WPF ListBox with self-removing items

穿精又带淫゛_ 提交于 2019-12-07 12:46:20
问题 I am trying to set up a listbox where users can remove items by clicking on each value they want to remove. I set up the style for my listbox (DisplayName is a member of the item class) in orderto include a button for each item: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding DisplayName}" /> <Button Content="[x]" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> Now I am having trouble trying to set the button to delete the