listbox

Silverlight - binding a listbox within a listbox template

北城余情 提交于 2019-12-06 07:58:58
In silverlight, I'm trying to build a listbox of reports and I'm trying to show the parameters of the report in a listbox within the datatemplate of the outer reports listbox. Here are the data classes: public class Report { public string Title { get; set; } public string Description { get; set; } public List<ReportParameter> Parameters = new List<ReportParameter>(); } public class ReportParameter { public string Name { get; set; } public string ParameterType { get; set; } public bool Required { get; set; } } Here's the XAML I'm trying to use to do it: <ListBox x:Name="lstReports"> <ListBox

How to Find the Greatest and lowest value in listbox

送分小仙女□ 提交于 2019-12-06 07:39:09
I am new in c#, I am using these to find the greatest and lowest value . int[] numbers = new[] { 1,2,3,4,5 }; int min = numbers.Min(); int max = numbers.Max(); I want to find the greatest and lowest value from list box by something like this int[] numbers = new[] { listbox1.items }; int min = numbers.Min(); int max = numbers.Max(); There would be great appreciation if someone could help me. Thanks In Advance. try this: var numbers = listBox1.Items.Cast<object>().Select(obj => Convert.ToInt32(obj)); int min = numbers.Min(); int max = numbers.Max(); 来源: https://stackoverflow.com/questions

Can I get a WPF ListBox to inherit brushes from parent element?

时间秒杀一切 提交于 2019-12-06 07:27:34
问题 My WPF window has its foreground brush set to a brush from a resource dictionary, and I want all text in the window to have this color, so I don't touch the foreground brush in anything else. Textboxes get the color Textblocks get the color Buttons get the color Listboxes do not get the color, and so neither do their contents. Is there any way to get a Listbox to behave like the other controls in this respect? Assuming not, and that this is by design, what is the rationale? Edit: It seems my

How Can I Get the Index of An Item in a ListBox?

亡梦爱人 提交于 2019-12-06 07:17:02
问题 I am adding items to a ListBox like so: myListBox.Items.addRange(myObjectArray); and I also want to select some of the items I add by the following: foreach(MyObject m in otherListOfMyObjects) { int index = myListBox.Items.IndexOf(m); myListBox.SelectedIndices.Add(index); } however index is always -1 . Is there a different way to get the index of an object in a ListBox ? 回答1: You should make sure that MyObject overrides Equals() , GetHashCode() and ToString() so that the IndexOf() method can

Binding items into ListBox multiple columns

£可爱£侵袭症+ 提交于 2019-12-06 07:12:08
I am trying to add my data into multiple columns ListBox, I did it but I am facing a hard problem when trying to retrieve the Data from the list box. is there a way to put an object instead of text into a listBox row? <ListView Name="listBox1" ItemsSource="{Binding Items}" Margin="28,28,68,67" FlowDirection="RightToLeft" MouseDoubleClick="listBox1_MouseDoubleClick"> <ListView Name="listBox1" ItemsSource="{Binding Items}" Margin="28,28,68,67" FlowDirection="RightToLeft" MouseDoubleClick="listBox1_MouseDoubleClick"> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn Header="a" Width=

WPF listbox dynamically populated - how to get it to refresh?

本秂侑毒 提交于 2019-12-06 07:03:23
问题 I am new to WPF, so I thought this was simple. I have a form with a listbox and a button. In the click handler for the button I do something iteratively that generates strings, which I want to put in the listbox as I get them. The xaml for the list box is like <ListBox Height="87" Margin="12,0,12,10" Name="lbxProgress" VerticalAlignment="Bottom"> <ListBox.BindingGroup> <BindingGroup Name="{x:Null}" NotifyOnValidationError="False" /> </ListBox.BindingGroup> </ListBox> and the click handler is

Implementing scrollable table on Windows Phone

早过忘川 提交于 2019-12-06 06:58:46
问题 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

Drag and Drop ListBox for WPF

江枫思渺然 提交于 2019-12-06 06:24:46
问题 I'm looking for just a simple ListBox with build-in Drag & Drop. I think that Silverlight 4 Toolkit has something like that. The BoxList should be able to: reorder by dragging & dropping items drag item from one BoxList to another display preview (ghost version) of dragged item show drop location (like a line between items where the dragged will be inserted) I hope there is some solution from microsoft (in toolkit for example), but if not I all be happy with any working solution. For example

Populate list box with a named range

只愿长相守 提交于 2019-12-06 05:56:16
I'm working on my first ever VBA project, and need a bit of absolute newbie guidance. I have a submission form that staff will be using to submit their daily KPIs. I have a list box control in a user form called "lstName" that employees will use to select their name before submitting the form Employee names are stored in a named range on "Sheet11" called "EmpName". I want to direct the list box to draw the list of names from the "EmpName" range on Sheet11; but don't know how I would do this in VBA. I was going to use RowSource to point the list box to the data, but I am lost as to how to do

How to display items horizontally in a listbox control?

て烟熏妆下的殇ゞ 提交于 2019-12-06 05:22:27
问题 I am developing window phone 7 application. I am new to the window phone 7 application. I have the following listbox control in my application <ListBox Margin="0,355,70,205" Name="WeekSummaryListBox" DataContext="{Binding}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock TextWrapping="Wrap" Width="150" Text="{Binding Amount}" Foreground="Orange"></TextBlock> <TextBlock TextWrapping="Wrap" Width="150" Text="{Binding Currency}" Foreground="Orange"><