listbox

Listbox won't display value

自闭症网瘾萝莉.ら 提交于 2019-12-02 09:02:56
From my usercontrol I tried to show value inside a listbox named PersonList Usercontrol Code: BindingList<NotifiablePerson> PerSonList = new BindingList<NotifiablePerson>(); SqlCommand prsonListCmd = new SqlCommand("SQL QUERY", conn); SqlDataReader dr = prsonListCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { //collect value from database and save inside Fname and Lname variable NotifiablePerson np = PerSonList.AddNew(); np.FirstName = Fname; np.LastName = Lname; } } PersonList.DisplayMember = "np.FirstName" + "np.LastName"; PersonList.ValueMember = "np.FirstName"; PersonList

Equally outlining listbox values in C# with the PadLeft function

牧云@^-^@ 提交于 2019-12-02 08:54:24
I am wrestling with my listbox and values in the listbox for some time now and I stumbled across another problem. I am fetching data from my Access database (both the field names and the values) and displaying them in a listbox. I am trying to outline the values of the field names to the right of the field name on a equal distance (so they are all below each other). I am trying to use the PadLeft function for this but for some reason this doesn't outline them below each other. I think this has something to do with the Length of the field names. The result what i am getting with this line of

ListBox templating: how to create a common template but still change content based on item

依然范特西╮ 提交于 2019-12-02 08:50:28
I've been templating ListBoxes for sometime in WPF, but I was wondering if there was a way to have a template for the ListBoxItem that would apply to all the items in the ListBox, but also have a ItemTemplateSelector to alter the contents of the containers. I have a list of strings and images and I want to display them uniquely such that the image displays with a frame and strings display in a textbox to be edited. I made an ItemTemplateSelector and select the template based on the type. However I want to add some controls, like a button to delete and a checkbox to display selection to both

Run throguh visual tree and set all Images to null

≡放荡痞女 提交于 2019-12-02 08:46:55
I saw tons of threads with memory leaking while using images. So, is it a good idea just to have a general function, some kind of own GC, which would run at NavigatingFrom, find all images (even in templates of virtualized lists) and set them to null? Here is an helper to iterate throught all the images of your page: public IEnumerable<Image> GetAllImage(DependencyObject root) { var count = VisualTreeHelper.GetChildrenCount(parentElement); for (int i = 0; i < count; i++) { var child = VisualTreeHelper.GetChild(parentElement, i); if (child is Image) { yield return (Image)child; } foreach (var

Trying to understand transfering listbox values/items with sessions.

前提是你 提交于 2019-12-02 08:41:58
On my first page I have two listboxes for Movies and Snacks They are called lbDisplay for Movies and lbSelected for Snacks . I am currently using a "Go to cart" function that has the following code: Session["lbSelectedMovies"] = lbDisplay; Session["lbSelectedSnacks"] = lbSelected; Response.Redirect("RingU6POSReview.aspx"); on the redirected page the two listboxes that I want the given values to transfer to are called lbRvMovies and lbRvSnacks The page is called RingU6POSReview.aspx Can anyone help me understand how to transfer the values when I redirect the customer? On the 2nd page say you

How to bind to a source inside a ListBox different from the ItemsSource already specified

可紊 提交于 2019-12-02 08:08:58
问题 I have a ListBox inside a HubSection, whose Items are bound to a class "players" added to my DefaulViewModel via code behind. First I simply put a TextBox bound to the property "PlayerName" of my class "players". Now I would like to add a ComboBox with some items that are NOT part of the class players. Is it possible ? I thought that definind an ItemsSource in the ComboBox would sort of override the ItemsSource of the ListBox, but nothing displays. The DataContext of the whole page is defined

Get data from clicked item in ListBox

安稳与你 提交于 2019-12-02 08:08:54
问题 I am new to Windows Phone, I have one listbox with textblocks in it, I want to fetch all data from selected item in listbox. Here is my code snippet: .xaml file <ListBox HorizontalAlignment="Left" Name="listbox1" ItemsSource="{Binding}" Margin="9,10,0,0" SelectionChanged="listBox1_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0,0,0,5"> <Image HorizontalAlignment="Left" Height="100" Margin="0,15,0,0" VerticalAlignment="Top""/> <TextBlock Text="{Binding

I wanted to use ListBox so that I can select the entry rather than TextBox

半世苍凉 提交于 2019-12-02 08:00:41
Excel 2013 with vba: I have 2 columns in Sheet1 Column A has NBA Players while Column B shows their Jersey Numbers. If I type 2 in txtNumber it will display Players with number 2 on their Jerseys. It works on that way, However I can't click or select the entry or data. I'm thinking that Listbox would be a better replacement for TextBox, however I just don't know how to use the listbox. Please help. Screenshot code: Private Sub txtNumber_Change() Dim mySheet As Worksheet 'declaring mySheet as the Worksheet... Dim x Dim i As Long Dim str As String Set mySheet = Sheets("Sheet1") x = mySheet.Range

How to Remove selected item from listbox C#

◇◆丶佛笑我妖孽 提交于 2019-12-02 07:56:54
i currently trying to view all the files and folder selected by the user in a listbox. At the Moment i am able to list what the user have chosen using the openfiledialogue HOWEVER i am now facing prob when i try to remove it form the listbox. i trying to allow the user to click on the checkbox beside the file and press the remove button to remove it this is my code for remove button private void button2_Click(object sender, EventArgs e) { for (int i = listView1.SelectedItems.Count - 1; i >= 0; i--) { listView1.Items.Remove(listView1.SelectedItems[i]); } } this is the add file to listbox for

styling HTML form list box with CSS or jQuery

时光怂恿深爱的人放手 提交于 2019-12-02 07:56:37
I want to simply change the colors and define the edges of a multiple line select box, or list box. I have seen a few threads on similar subjects, but not quite the solutions I am looking for. I need to be able to: Change hover color of elements Change select color of elements Change border Style side slider (not essential) I think I might have to use JS (via jQuery, if possible), but would much rather use CSS is I can. Here is what I mean by a list box there is no possibility to do this just with CSS. Take a look at this plugin: github.com/vladfr/jquery-coolmultiple Try these http://www