listbox

ListBox+WrapPanel arrow key navigation

只谈情不闲聊 提交于 2019-12-04 09:39:10
问题 I'm trying to achieve the equivalent of a WinForms ListView with its View property set to View.List . Visually, the following works fine. The file names in my Listbox go from top to bottom, and then wrap to a new column. Here's the basic XAML I'm working with: <ListBox Name="thelist" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True" Orientation="Vertical" />

Implementing scrollable table on Windows Phone

我与影子孤独终老i 提交于 2019-12-04 09:14:16
I need to create an app for TV guide. Requirement is that UI must be a copy of one you can see here: raspored.bnet.hr . As you can see, there's a lot of data. So, basically it would be a large scrollable table. Since there is no such UI control as table on Windows Phone, I found out that the best approach would be to create one vertical listbox with horizontal listboxes as its items. This is all ok and I'm able to create it. But, to make it behave like a table I also need to make these horizontal listboxes scroll in sync, not to scroll one row at a time. Then I disabled horizontal scroll on

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

落花浮王杯 提交于 2019-12-04 08:59:01
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 have a LISTBOX specified in its declaration as follows: // resource.h #define IDD_MAIN 101 #define IDC

Win32 LB_GETTEXT returns garbage

大城市里の小女人 提交于 2019-12-04 08:43:49
I have a problem which is most likely a simple problem, but neverthe less still a problem for me. I am using the Listbox in Win32 / C++ and when getting the selected text from my listbox the string returned is just garbage. It is a handle to a struct or similar? Below is the code and an example of what I get. std::string Listbox::GetSelected() { int index = -1; int count = 0; count = SendMessage(control, LB_GETSELCOUNT, 0, 0); if(count > 0) { index = SendMessage(control, LB_GETSEL, 0, 0); } return GetString(index); } std::string Listbox::GetString(int index) { int count = 0; int length = 0;

WPF ListBox Button Selected Item

北战南征 提交于 2019-12-04 08:18:33
I have a listbox with some textblocks and a button -- in the button's codebehind it calls a method passing the currently selected listbox item, this works great. The issue is that when I select an item and then click the button on another item it doesn't update the "SelectedItem" property -- is there a way Xaml or C# that I can force a button click to select the parent ListBoxItem? Xaml <DataTemplate> <Grid> <Button x:Name="myButton" Click="myButton_Click" Height="30" Width="30"> <Image Source="Resources\Image.png" /> </Button> <TextBlock Text="{Binding DataField}"></TextBlock> </Grid> <

Prevent WPF ListView or ListBox from showing “half” Items

笑着哭i 提交于 2019-12-04 07:40:32
in our application we have some ListViews and ListBoxes inside grids where you can change the actual height of the control with help of a grid splitter. When doing so you are able to arrange the height of the ListBox so one of the items is not fully visible because the ListView becomes to short to display it. This is a behavior we don't want. From my research so far it seems there is not way the prevent a ListBox or ListView from showing partial items but maybe someone found another way to deal with this problem. Maybe the item can trigger itself invisible when it is only half visible. But how

Selecting multiple Listbox items through code

泪湿孤枕 提交于 2019-12-04 07:39:08
Hi there I have searched for a while now and can't seem to find a solution to my problem, I have tried multiple methods to select multiple items in my listbox through code however none have worked, The best result I got was 1 selected item in my listbox. Basically I want to select multiple items of the same value. below is my code, sorry if I seem newbie but I am new to programming and still learning basic stuff. foreach (string p in listBox1.Items) { if (p == searchstring) { index = listBox1.Items.IndexOf(p); listBox1.SetSelected(index,true); } } So as you can see I am trying to tell the

ListBox elements rearranged with JavaScript causing event validation error on postback

醉酒当歌 提交于 2019-12-04 07:20:47
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 argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in

WP7 TextBlock inside a ListBox not wrapping text

只谈情不闲聊 提交于 2019-12-04 07:15:37
I have a ListBox which has StackPanel s holding a TextBlock and an Image horizontally, followed by a ContentPresenter . This is what the XAML looks like: <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <ListBox x:Name="MainListBox" Margin="12,0,12,0" SelectionChanged="MainListBox_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu x:Name="ContextMenu" Opened="ContextMenu_Opened"> <toolkit:MenuItem Header="edit" Tag="edit" Click="MenuItem_Click" /> <toolkit:MenuItem Header="delete" Tag="delete" Click=

How can make ScrollViewer scroll when mouse is over *any* content

て烟熏妆下的殇ゞ 提交于 2019-12-04 06:46:41
The reason I stress 'any' is because CanContentScroll is not fully working in my ScollViewer . Let me explain the scenario: I have a ScrollViewer that has three Labels followed by a ListBox each. The reason I have this content inside the ScrollViewer is because I don't want each ListBox to have a ScrollBar , I just want one "global" ScrollBar . The problem is that when the cursor is over the the ListBox the ScrollViewer doesn't scroll. I've tried to set CanContentScroll property to true in the ScrollViewer, the ListBox and on the ListBoxItem style, without success. Is there other Control type