I have 3 ListViews in a WPF Grid Column, one each for customers, products, and vendors.
They each get data from LINQs to separate SS2005 queries in the same DB.
The lists are populated when a user enters text in a TextBox.
The LINQ query code uses as startswith() function that reads the user entry and returns a smaller list to the ListView.
When the code is run, each ListView is populated properly.
However, the Products list doesn't display the entries.
I attached a call to a MessageBox to the selection event of the ListItem and the message box correctly displays the product.
The single difference between the two working lists and the bad one is the query that calls the bad one returns a single field from the DB and the others return two fields, a text field and an integer ID field.
I'm at a loss.
The background of the ListView is white, the foreground is black (they were set using the properties panel).
Related
I am sure this question has an easy answer but I need to ask it. I have a historical records database and an events form to enter events, dates etc into an events table. (I would like to post a reduced version of the database but cant seem to do this on the is forum.) There are hundred of events (this is history) and, to reduce the number of options in entering data, an unbound combo box (ETCIDcbx) in the entry form EventF selects categories of events from another table (EventTypeT) containing event categories (ETCID) and event types (ETID) and the value in this combo box is then the value in a Query (FindEventTypefromCategoryluQ) which selects a subset of event types which appear in the combo box ETIDcbx (bound to field ETID in the EventT table). The problem is that the ETIDcbx does not update as I scroll through events so I don't know if the event type is correct. Another combo box is bound to the control ETID but it displays only the numbers (which are hard to keep track of) rather than the description of the event type. Can anyone help?
I have been tasked with creating a like for like user interface for a product replacement.
One of the components of the old system was a container that displayed properties in a hierarchy (think treeview like) where each property had a label and value (value could be a textbox, drop down, checkbox, file browse etc)
This is the component that I need to replace and one of the conditions being imposed on me is to front load it with about 5000 items, some of which will be made visible depending on usage context.
My first attempt has been to use a FlowLayoutPanel as the main container populated by TableLayoutPanels indented on left margin that each hold label and edit control.
I hit the problem of the 10,000 control handles limit.
Any suggestions on an alterantive approach to get round this limitation that will allow for the front loading of the 5000 items?
Thanks in advance.
Consider the following guidelines:
1. Do not load all the records at once. Load the data page by page as per request, and render each page of data.
2. Do not show all the records at once. You have a limited window size, even if you load all the data, just show the part that should be visible in the view port. Show the rest of the data when the user scrolls. This way you can dispose the previous elements.
3. Do not use a lot of handles. You can use a control which uses just 1 control handle, like a TreeView or DataGridView or even a custom control for yourself. The key is keeping data in view mode and just show the edit controls when the user focus on a specific item to edit.
Example: DataGridView and ListView controls support virtual mode for loading data. You can also simulate nested data by padding the first cell/item. Also the Treeview control supports events like BeforeExpand which allows you to load child data when the user requests.
For all above examples you can just show the edit controls when the user wants to edit the cell.
Let say, I have ListView, how do I bind/connect it with another data-set?
For example: Screenshot
A new row added, new default extra data added
A specific row is selected, display extra data
All row selected, display similar data and display multiple value if not same
All row selected, change a extra data, all selected row apply new data
A specific row deleted, the extra data also gets deleted.
this not connected with database, just simple data in the memory
A standard .NET ListView doesn't support data binding.
You will need to switch to DataGrid (which has its own problems) or a data bindable version of ListView, like ObjectListView.
I have an app in C# WPF with an existing .rdlc file added to a ReportViewer. The report already has datasets. Here is a printscreen: link. Now, I have a DataGrid that's bound to an ObservableCollection. How can I pass data from the collection to the fields of the dataset? The parts of the items of the ObservableCollection have the same type as the fields of the datasets but have different names. So I want the user to be able to select a single row from the DataGrid and the records of this row (parts of an item of the ObservableCollection) to fill the appropriate fields of the dataset thus showing a populated report in my ReportViewer. And whenever the user selects a different row, the data in the report should change accordingly. I hope I've been clear. I've read about IEnumerable and List<T> set as datasource but I don't get that. I just want to overwrite the fields of my dataset as if they were parts of a structure or a class and then present them in the formatted report. Can this be done in a similar, simple way? Because I don't know why I would want to take my item from the ObservableCollection and make a List<> out of it. But in case I chose this option should the items of the List<> have the same name and type as the fields in the dataset?
Thank you for your answer in advance!
Requirement:
1. Show a list of all referral types in a combo box. (eg. Newspaper, Yellow Pages, Client)
2. Upon choosing client, a popup is shown where they can search for clients within the system.
3. From the popup, the user can choose one client.
4. Popup will be dismissed and the client name will be populated into the combobox.
I'm almost done with the implementation, wherein requirements 1 thru 3 are done. However, I'm stuck with number 4. The reason is that, the combobox is bound to referraltype objects. However, the chosen item from the popup is of type "client". Right now, I'm just displaying the chosen client in a separate textblock. However, the customer wants it to be displayed as part of the combobox itself.
Not sure how it could be done.
Any help would be appreciated.
Thanks
Bala
You could have a BaseReferralTypeViewModel which NewspaperViewModel, YellowPagesViewModel and ClientViewModel all inherit from. In the combo box resources in xaml declare DataTemplates which describe how to display these types in the combo box. In the case of the first two types its probably just a text block.
In the case of the ClientViewModel create an instance but don't initialise it with any client data.
The DataTemplate can detect this and just display the referral type.
Once the ClientViewModel is initialised with client data by the popup the DataTemplate will detect this and display the name.