listbox

listbox Refresh() in c#

て烟熏妆下的殇ゞ 提交于 2020-01-10 14:18:39
问题 int[] arr = int[100]; listBox1.DataSource = arr; void ComboBox1SelectedIndexChanged(object sender, EventArgs e) { .....//some processes listBox1.DataSource = null; listBox1.DataSource = arr; } is not working, also, listBox1.Refresh(); is not working, also, listBox1.Update(); is not working, i know i can use BindingList<T> but i have to work with only array. can you help me how can i refresh listbox? 回答1: try the following listBox1.DataBind() 回答2: my first answer on stack exchange here. C#

How can I make some items in a ListBox bold?

人盡茶涼 提交于 2020-01-10 13:15:13
问题 In Visual c# Express Edition, is it possible to make some (but not all) items in a ListBox bold? I can't find any sort of option for this in the API. 回答1: You need to change listbox's DrawMode to DrawMode.OwnerDrawFixed. Check out these articles on msdn: DrawMode Enumeration ListBox.DrawItem Event Graphics.DrawString Method Also look at this question on msdn forums: Question on ListBox items A simple example (both items - Black-Arial-10-Bold): public partial class Form1 : Form { public Form1(

In a WPF ListBox with more than 1000 Image Items the Zoom Images become slow

自闭症网瘾萝莉.ら 提交于 2020-01-10 10:24:07
问题 I met a problem when deveoping a photo viewer application. I use ListBox to Show Images, which is contained in a ObservableCollection. I bind the ListBox's ItemsSource to the ObservableCollection. <DataTemplate DataType="{x:Type modeldata:ImageInfo}"> <Image Margin="6" Source="{Binding Thumbnail}" Width="{Binding ZoomBarWidth.Width, Source={StaticResource zoombarmanager}}" Height="{Binding ZoomBarWidth.Width, Source={StaticResource zoombarmanager}}"/> </DataTemplate> <Grid DataContext="

TwoWay Manual Binding Implementation for ListBox.SelectedItems?

℡╲_俬逩灬. 提交于 2020-01-10 07:27:06
问题 I've been trying to see if there is an easy/clever way to implement binding to ListBox.SelectedItems. If you have tried yourself, you will know, that markup binding using BindingExtension will not work - the property doesn't support it. So you are left with wiring up a handler for SelectionChanged and trying that route. The closest I've gotten is this post: http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry Update: the above mentioned blog is no longer available, that author

Get reference to my WPF ListBox's ScrollViewer in C#?

流过昼夜 提交于 2020-01-10 04:20:07
问题 I think this should be easy but I'm having a tough time with it. How can I get a reference to my ListBox's scrollviewer in C#? I've tried pretty much everything I can think of. The ListBox is in a WPF Custom Control so we use Template.FindName to get references to all our controls. My ListBox looks like this: <ListBox x:Name="PART_SoundList" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" Focusable=

Custom styled listbox - how can I keep the style for a selected item?

匆匆过客 提交于 2020-01-10 04:07:05
问题 I have a styled listbox. Listbox items change color when hovered over and when selected. Hover and select work fine. But when selecting an item then taking the mouse off it and coming back to hover over it causes it to go back to hover/unselected state even though it is still selected. How can I keep the listboxitem in a "selected" visual state? <Style x:Name="myListBoxItemStyle" TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem">

Child elements of scrollviewer preventing scrolling with mouse wheel?

六月ゝ 毕业季﹏ 提交于 2020-01-09 04:38:08
问题 I'm having a problem getting mouse wheel scrolling to work in the following XAML, which I have simplified for clarity: <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" CanContentScroll="False" > <Grid MouseDown="Editor_MouseDown" MouseUp="Editor_MouseUp" MouseMove="Editor_MouseMove" Focusable="False" > <Grid.Resources> <DataTemplate DataType="{x:Type local:DataFieldModel}" > <Grid Margin="0,2,2,2" > <TextBox Cursor="IBeam" MouseDown="TextBox

Update listBox on Main page from button click event on child window.

…衆ロ難τιáo~ 提交于 2020-01-07 08:29:28
问题 I have a Main page that contains a listBox. When a user selects a profile form the list box, this opens up a child window called pWindow . This window as the option to delete the current profile via a hyperlink button that opens up a another confirmation window called dprofile . My question being is it possible that once a user has confirmed to delete the current profile they are in, and confirmed it in the button click on dProfile , how can I update the listBox in the first Main page so that

Listbox populate with specific rows

心已入冬 提交于 2020-01-07 08:06:10
问题 I want to populate a vba listbox from a database only with specific rows. This is what I got. Private Sub UserForm_Initialize() Hoja2.Activate ListBox1.ColumnCount = 5 ListBox1.ColumnWidths = "70;90;90;90;70" ListBox1.AddItem "FIRST NAME" ListBox1.List(0, 1) = "LAST NAME" ListBox1.List(0, 2) = "LAST NAME 2" ListBox1.List(0, 3) = "BORN DATE" ListBox1.List(0, 4) = "AGE" Dim seguimiento As Integer Dim i As Integer seguimiento = Application.WorksheetFunction.CountA(Range("b:b")) For i = 1 To

Bubble sort for Listbox not working C#

那年仲夏 提交于 2020-01-07 05:46:07
问题 I have a program where the user can input number into a listbox the user also gets and option to sort the listbox. I am not allowed to use any arrays or containers or list, just modify the items listbox property and use converting and parsing. I want to do this through a bubble sort, although the numbers that only displays on the listbox once the sort button is clicked is 0,1,2,3,4... private void sorted() { int a = Convert.ToInt32(lstHoldValue.Items.Count); int temp = Convert.ToInt32