listbox

Adding items to listbox from excel

感情迁移 提交于 2019-12-24 15:51:44
问题 I have a column in an Excel file that contain 100 rows. I'm trying to import this column into a ListBox using a button. The problem is that only 48 rows are importing from the Excel column. Why aren't all the rows inside the column imported? Here is my code (vb.net form): Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click Dim oExcel As Object = CreateObject("Excel.Application") Dim oBook As Object = oExcel.Workbooks.Open("C:\Users\User\Desktop\1.xlsx") Dim

Selected Item Background?

本秂侑毒 提交于 2019-12-24 14:17:03
问题 I have a ListBox with a buttons DataTemplate . The ListBox view items are in a list of ToggleButton s. My problem is the with selected item background as shown in picture: As shown, the problem is in button one. This screenshot was taken when the wpf page is first loaded (before the toggle button is checked). If I then check the togglebutton (button one) the white in the border will disappear I don't want this white color shown (like two button). I have: <ListBox x:Name="lbname" ItemsSource="

Silverlight, DataTemplate, Binding to click event

可紊 提交于 2019-12-24 14:07:15
问题 Good day, I'm getting desperate here. Consider the following use case. I have a listbox which item's are custom templated control. It has several buttons for which this custom control has event handlers in code behind. Whenever button is clicked I call a method of the object my custom control is bound to through the DataContext. So, when user clicks stop, I call _context.stopDownload() and object does the rest. But, I have one button which should start the playback of the content. I am trying

Multi value ListBox automatically selects undesired item

荒凉一梦 提交于 2019-12-24 13:19:13
问题 I have an object that has some attributes from the list selected - let's say a Promotion that can have 0 to X communication channels. To display/edit this information I am using a listbox with option SelectionMode==MultiExtended. But in some cases it is behaving strangely I have Promotion with 2 communication channels selected (first and last out of three channels), I click on a second channel (that previously was the only unselected channel) and know it shows, that 1st and 2nd channels are

How to remove collapsed space in a listbox with items type wrappanel, full source + pic included

无人久伴 提交于 2019-12-24 12:34:11
问题 I have a ListBox with ItemsPanelTemplate of WrapPanel. There's some left & right padding of the collapsed elements, which I want to get rid of... When the elements are visible, the image is a nice square with five buttons per row. Here is an image: http://iterationx.posterous.com/71739342 How can I get rid of the padding at the beginning of the first button when my A-E buttons are collapsed? <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml

Making a collection of WPF Expanders 'expand' exclusively, i.e. only one expanded at a time

蹲街弑〆低调 提交于 2019-12-24 12:34:07
问题 I have a ListBox containing a group of 'Expander' items, and what I would like to do is make the IsExpanded property for each of them exclusive. For example, if I have 10 Expanders in the ListBox , I'd like only one to be open at a time. Here is what I have so far: <Window> <Window.Resources> <DataTemplate x:Key="NormalTemplate"> <Expander Margin="0" IsExpanded="True" Header="{Binding Model.Name}" Background="Green"> <Grid> <StackPanel HorizontalAlignment="Stretch"> <TextBlock Text="{Binding

Find Control in DataTemplate with a multi selection listbox

我的未来我决定 提交于 2019-12-24 12:12:06
问题 I have a multi selection listbox where a user can tick multiple items in the list. At the moment I have it so when a checkbox is ticked the ListBoxItem it is within also gets selected: private void CheckBox_Checked(object sender, RoutedEventArgs e) { //Select the Item using the DataContext of the Button object clicked = (e.OriginalSource as FrameworkElement).DataContext; var lbi = LstDistro.ItemContainerGenerator.ContainerFromItem(clicked) as ListBoxItem; lbi.IsSelected = true; } Now I am

How to do dynamic binding with Listbox in silverlight?

隐身守侯 提交于 2019-12-24 11:36:27
问题 I am developing silverlight 4 application. I am using the following listbox for dynamic binding <ListBox Margin="44,100,46,138" x:Name="lstbox1"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical"> <TextBlock Text="{Binding A1}" Foreground="Gray" FontSize="14" Width="100" Height="20" ></TextBlock> <TextBlock Text="{Binding A2}" Foreground="Red" Width="100" Height="20" ></TextBlock> <Line X1="-3400" Y1="32" X2="10" Y2="32" Stroke="Gray" StrokeThickness="1"/> </StackPanel>

How to change a ListBox's Vertical Scrollbar's Repeat Button Size in WPF

僤鯓⒐⒋嵵緔 提交于 2019-12-24 10:56:52
问题 I have a ListBox control with a vertical scrollbar. I would like to increase the Repeat Buttons' Height to something bigger because our UI is touch-compatible. Is there a simple way to do it ? Thank you and best regards, Romanin 回答1: Easiest is to modify the ControlTemplate for a vertical scrollbar and change it to what you want: ScrollBar ControlTemplate Example 回答2: It's not so easy to just change the button sizes, because they are hardcoded in the default template. But you can scale the

How do I determine the number of visible items in a listbox with urwid?

≯℡__Kan透↙ 提交于 2019-12-24 10:01:39
问题 I'd like to implement some hinting as to whether there remains items below or above the list of visible items in an urwid.ListBox when I scroll it up or down. The 'scroll down' hint should appear only when there remains items after the last visible item and it should disappear when the last, visible item is the last item in the list. The reverse applies with the 'scroll up' hint. I then need to know how many visible items there is in the list. Is there a way to retrieve the number of visible