listbox

How to Implement a ListBox of Checkboxes in WPF?

巧了我就是萌 提交于 2019-12-03 15:04:14
问题 Although somewhat experienced with writing Winforms applications, the... "vagueness" of WPF still eludes me in terms of best practices and design patterns. Despite populating my list at runtime, my listbox appears empty. I have followed the simple instructions from this helpful article to no avail. I suspect that I'm missing some sort of DataBind() method where I tell the listbox that I'm done modifying the underlying list. In my MainWindow.xaml, I have: <ListBox ItemsSource="{Binding

Searching a listBox for a specified string VB6

混江龙づ霸主 提交于 2019-12-03 14:22:44
I have a listbox called lstSerial and a textbox called txtSerials. What I want to do is search lstSerial for the string that's entered in txtSerials. I'm using VB6 in Microsoft Visual Basic 6.0, and I'm having a terrible time finding documentation. Thanks. @AlexK's answer is technically correct - yes - it will work, but it's not the preferred way to go. There is an API call for this very purpose: Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As _ Integer, ByVal lParam As Any) As Long 'constants for searching the

Listbox Separator in WPF and Omission of Final Separator

只愿长相守 提交于 2019-12-03 13:50:16
I have two things I'm trying to achieve: Add a horizontal separator between listbox items in WPF. Don't show the separator at the bottom of the final listbox item. My current layout is pictured here: This shows 2 listbox items (though I have no way of knowing how many items could potentially be generated). I would like them separated by a horizontal separator, except on the last listbox item so there isn't a spare separator at the bottom of the pane. How can I achieve this in XAML? See my current XAML here: <TabItem Header="Third Party Updates"> <Grid> <TextBlock Name=

How to use Canvas as the ItemsPanel for an ItemsControl in Silverlight 3

早过忘川 提交于 2019-12-03 13:17:17
问题 I am trying to set the Canvas properties in an ItemsControl DataTemplate with Silverlight 3. According to this post, the only way of doing that is to set it using the ItemsContainerStyle for the ContentPresenter type, since the Canvas properties only take effect on direct children of the Canvas. This doesn't seem to work in SL3, since the ItemsControl doesn't have an ItemsContainerStyle property, so I tried a ListBox as advised by this article, but it still doesn't work. From the XAML below,

Double buffered ListBox

随声附和 提交于 2019-12-03 13:08:09
I have a CheckedListBox (WinForms) control (which inherits from ListBox; googling shows that the problem is with ListBox) that is anchored to all four sides of its form. When the form is resized, the ListBox has an ugly flicker. I tried inheriting CheckedListBox and setting DoubleBuffered to true in the ctor (this technique works with other controls, including ListView and DataGridView), but it had no effect. I tried adding the WS_EX_COMPOSITED style to CreateParams , and this helped, but makes the form resize mush more slowly. Is there any other way to prevent this flickering? Eric I was

C# ListBox ObservableCollection<T>

拟墨画扇 提交于 2019-12-03 13:06:00
I'm trying to use a ListBox.DataSource = ObservableCollection, however I can't figure out how to have the listbox automatically update when my OC updates. I can hook the CollectionChanged event on the OC, however what do I need to do to the listbox to make it update? Justin Niessner Based on your question, it sounds like you're trying to use ObservableCollection<T> in a WinForms application. ObservableCollection<T> is primarily used in WPF development. In WinForms, for the control be automatically updates as the collection changes your collection needs to implement IBindingList . The easiest

WPF Single selection between two ListBoxes

[亡魂溺海] 提交于 2019-12-03 12:50:41
I'm having the following problem: I have two ListBox , with two different ItemSource , but both of them have the same binding for the SelectedItem , because I was trying to perform a single selection between these two lists. Here's an image that better shows the problem: What would I like to do? Every time I select one item from the first list (in red), it should deselect the SelectedItem from the second list (in black), and vice versa. That's why I'm using the same binding for both of them. I really don't know if it's the better way to do it, but it should work like that. Could you help me?

ListBox Style Selected item on windows phone

雨燕双飞 提交于 2019-12-03 11:45:40
i would like know how can i add a style when a item of the listbox is selected. I have the following listbox: <ListBox x:Name="ListBoxDays" VerticalAlignment="Top" ItemTemplate="{StaticResource WeekDayTemplate}" ItemsSource="{Binding WeekDayList}" /> And i also have a DataTemplate to the listbox. <phone:PhoneApplicationPage.Resources> <DataTemplate x:Key="WeekDayTemplate"> <StackPanel x:Name="stackPanel" Orientation="Horizontal" Width="400" Margin="12,0,0,10" Height="100" > <StackPanel VerticalAlignment="Center" Orientation="Vertical"> <TextBlock Text="{Binding WeekDayName}" Style="

WPF - Very basic ListBox.ItemTemplate Question

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 11:37:59
问题 Ok, this is an embarassingly simple-looking problem, but is driving me crazy. I'm learning about DataTemplating and am trying to apply a very VERY simple ItemTemplate to a ListBox. However, when I run my app, the template is completely ignored and I just get the standard-looking listbox, whereas in fact I'd expect to see a list of checkboxes with 'Test' along side. I've tried this several times and always the same result. I've checked several resource on Google and all have the same kind of

WPF Listbox Wrapping

Deadly 提交于 2019-12-03 11:10:15
I have a listbox in which I use a ListBox.ItemsPanel - WrapPanel. <ListBox ItemsSource="{Binding Path=Applets}" Margin="10,92,10,10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical" IsItemsHost="True"> </WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate>... I am trying to have the wrappanel have a behavior such that the items fill in to the right as the width is made wider and wrap as needed when the window is made narrower. I have played with it but the correct combination eludes me.