listbox

WPF Listbox grouping

不羁的心 提交于 2019-12-06 05:19:17
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 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.Value> </Setter> </Style> <ListBox x:Name="lbPersonList" Margin="19,17,162,25" AlternationCount="2"> <ListBox

Wp8:Not able to get checkBox in listbox

做~自己de王妃 提交于 2019-12-06 05:08:49
I am not able to find checkbox in listbox xaml: <ListBox x:Name="my_list" Grid.Row="0"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" > <CheckBox x:Name="cbx_state" Tag="{Binding}"/> <TextBlock x:Name="txt_string" Text="{Binding}" VerticalAlignment="Center" FontSize="34" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ListBox> I am trying to get cbk_state so that i can set its checked property.The function i used to get the checkbox is private void GetItemsRecursive(DependencyObject lb) { var childrenCount = VisualTreeHelper.GetChildrenCount(lb

Select ListBox item on rightclick in Word VBA

不羁的心 提交于 2019-12-06 04:46:54
I'm developping a project in Word 2003 with VBA. I have a multiselect ListBox with some entries (dates). On rightclick I'd like to have an InputBox popping up where the user can change the selected date. This works well, as long a specific item is already focused (not only selected, but focused). But, if you rightclick on an item without focus, the box shows up and changes the date of the focused entry, not always the one you rightclicked. I found this answer ( http://www.vbarchiv.net/tipps/tipp_920-rechtsklick-in-der-standard-listbox-erkennen.html ) but it's not possible in VBA. Has anyone a

Two Way Binding on Multi-select WinForms Listbox?

走远了吗. 提交于 2019-12-06 04:33:00
I have a project where we are loading a multi-select listbox from a collection of objects. I have another entity object that has a collection that I want to bind to SelectedItems somehow. Is there any way to do this using object binding sources or some kind of binding source without writing code? Sure I can loop through the collection and get the selected items but I'd prefer to do it more cleanly with windows data-binding. Is this possible? Unfortunately you can't bind the SelectedItems (or CheckedItems in CheckedListBox)... I can't tell how many times I wished it were possible ! 来源: https:/

ListBox elements rearranged with JavaScript causing event validation error on postback

霸气de小男生 提交于 2019-12-06 04:21:08
问题 I have created an item swapper control consisting in two listboxes and some buttons that allow me to swap items between the two lists. The swapping is done using javascript. I also move items up and down in the list. Basically when I move the items to the list box on the right I store the datakeys of the elements (GUIDs) in a hiddenfield. On postback I simply read the GUIDs from the field. Everything works great but on postback, I get the following exception: Invalid postback or callback

WPF Listbox separator is shown with different thickness

戏子无情 提交于 2019-12-06 04:04:38
I have created a custom ListBox with each item separated by separator. But I am seeing weird issue. The thickness of separator is not constant across List items. It changes if I change the position of list box as shown in this List Box Image . Below is the source code of custom listbox. <Window x:Class="CustListBox.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:CustListBox" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <local:Manager x:Key="manager"/> <Style x:Key=

WPF listbox : problem with selection

本小妞迷上赌 提交于 2019-12-06 03:59:17
In my XAML file, I have a ListBox declared like this : <ListBox x:Name="lstDeck" Height="280" ItemsSource="{Binding Path=Deck}" > <ListBox.ItemTemplate> <DataTemplate> <ListBoxItem Content="{Binding}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> In my view model, Deck is an ObservableCollection, so that binding directly displays the content of my collection. But when I have several value that hold the same value (for example "10" six times), the selection in the ListBox has a weird behaviour : it select 2-3 elements instead of the only the one on which I clicked. Moreover, when I

Change color of specific item on listbox that contains a specific string on drawitem

六月ゝ 毕业季﹏ 提交于 2019-12-06 03:53:54
问题 i want to change the color of item that contains a specific string Private Sub ListBox2_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox2.DrawItem e.DrawBackground() If DrawItemState.Selected.ToString.Contains("specific string") Then e.Graphics.FillRectangle(Brushes.LightGreen, e.Bounds) End If e.DrawFocusRectangle() that is my code but not working 回答1: Alright, first you need to set the property DrawMode of the list box to "OwnerDrawFixed"

Win32: How to create a ListBox control using the CreateWindowExW() function?

為{幸葍}努か 提交于 2019-12-06 03:53:22
问题 I've been through multiple sites, documents and tutorials and they all say the same, that is, any control is nothing more than a window in Win32's API, hence one is able to use the CreateWindowExW() function to create a ListBox control/window over the main application window. Though I get the concepts of all controls being windows with different dwStyle , I have a hard time finding out how to instantiate, to say so, the ListBox control. I encountered a tutorial where a dialog is written to

VBA Refresh UserForm ListBox Data when source changes

我的梦境 提交于 2019-12-06 03:44:07
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 strDataRange As Range Dim keyRange As Range Set strDataRange = Range("I2:L4") Set keyRange = Range("I2:I4