I'm working on a wpf project with mvvm pattern, I have such a scenario: My window is seperated into two parts, the first part is simple, only a textbox for users to input keywords and a button for searching with keyword. The second part is user control, by default, it's a advanced search user control, users can select different selections, such as categories, authors, each of the selection support multiple selection. After user setting the filter in the advanced search user control, click search button in the first part to search. After the searching results return, replace the advanced search user control with a result list user control.
Should I create a viewmodel contains result collection, advanced search options and used for the main window and the two user controls? Or is there any more appropriate solution?
Thanks in advance!
Related
I'm trying to create a form that operates like the Visual Studio Properties page, with a list of categories (like Application, Build, Build Events etc) in a column on the left and corresponding information on the right. I'm planning to use either panels or a tabcontrol (with the tab header hidden) for the right hand side.
However, I'm unsure how best to create the column of categories on the left. Is there a standard control that provides this functionality?
Otherwise, I considered using a panel containing Buttons, or individual Panels, or a ListBox, but I don't think these would give the same look. Also, I don't want to write code if a suitable control already exists.
Ideally I would like to be able to easily disable all the categories, for example while editing a record on one page.
Having nested categories might be nice, but is not essential.
If the information on the right is not related to one another as you switch categories on the left, to create a good separation between categories I'd suggest you do the following:
Create a user control for each individual category
Split your form in two, the bar on the left and a panel on the right
The bar on the left, for the categories, can be a list of radio buttons, or links, or whatever you like. I'd suggest a TreeView since it easily support sub-categories.
As the user click on a category (by attaching a method to the corresponding even on the control used for the categories) you can remove the control from the panel, if any, and reset the control that corresponds to the selected category.
I have a WPF Application with different user controls. Each of them can be accessed by clicking a button on the left side. My issue is, when I am in one of the user controls and filling out the data in textboxes, combo boxes etc, I may have to stop it mid way and click on another user control. While doing that, I need to keep the data in the previous user control intact so that when I return to the first user control, the data should be present in all the controls before I left it. How do I achieve this? Here's a sample picture of how my application looks like:
Picture Credit: https://rachel53461.wordpress.com/2011/12/18/navigation-with-mvvm-2/
From the picture, if I am in the Products Page, I might have several text boxes with data entered in there. For a variety of reasons, I may have to step away from this and click on Home Page or some other page , do some work there and return back to the Products page. When I return, I need the data to be present as is when I left it.
Thanks in Advance
You must have create a ViewModel to each diferent user control.
ViewModel remains in memory until you process that or make a diferent process.
For Example you hava a User control for your Main Page, that's mean you have a view (MainPageView) of your user control for your main page, that view belong to a ViewModelMainPage.
For Products you maybe have a ProductView, that's belong to ViewModelProducts.
You must create a ManagerViewModel to manage the view for diferents user control.
I am new to C# and I am using windows forms.
I don't know if the term "browse" is right to use in this case or not.
I have Form1 with 3 buttons ( buttonA , buttonB and buttonc) in it.
I linked buttonA with a user control which contains 20 buttons and each one of those 20 buttons is linked to a user control which contains 10 buttons each of which does an action which it is clicked, also same thing applies to buttonB and buttonC . Now I configured user controls visibility when button clicked . For example:
Click buttonA user control1 with 20 buttons show up, click one of those 20 buttons another user control show up with 10 buttons.
What I am trying to do is something like browsing windows folders but in this way I will end up having too many user controls and it is confusing and I feel this is not the correct way of doing it. Can anyone please help me if there is another way to do taht? Thank you
What I am trying to do is: I click on
Your scenario seems to be ideal to use TreeView control. This controls displays a hierarchy of items, in your case a hierarchy of products and subprodcuts. A user of your application will be able to expand/collapse nodes as he/she want just by clicking a node. It is much more intuitive and readable than pressing buttons.
For example you can easily achieve the following icons:
You can also associate icons with nodes, change their background or foreground etc.
I think ListView control may fit your needs. It can display a lot of items in different forms (for your task consider using View.LargeIcon or View.Tile for ListView.View property). It also supports groups that may be useful for building POS system.
I have a large collection of items with several parameters, so i'd like to give a user a possibility to have different filters: like order by time, by alphabet, or by categories.
How should i implement filter selection in Metro style? Should it be a menu items like this, but with "filter by alphabet" instead of "menuitem 1" ?
Edit:
Some more details: so, assume we have Movie items with 4 fields: name, year of release, genre and main actor's name. I'd like to allow user to set filtering by 1 of those 4 fields. Actually, it is not filtering or sorting, its more like categorizing.
Ok, i found this thing, looking quite nice.
Edit: though, be careful, it is not working the same as on the picture. At least, current version is not fading the screen, so other controls still would react on user input and Back button.
No way - the AppBar menu is not the way to go. For filtered content, you would normally use LongListSelector (both on WP7 and WP8). The filtering can be set by you when you group (or re-group) the items bound to the control - for the filter setter you could use any control (e.g. a auto-complete text input control or a ListPicker).
I am developing a simple software in .NET C# for blind people that includes a phonebook.
The phonebook consists of a form with tabs in it (each tab represent a group i.e. family, friends , work etc.) and in each tab a listview that will contain the contacts in that group.
The groups are of course dynamic and user made.
My question is what is considered the proper way to handle the tabs? To create a new listview for every tab or one for all of them? how to handle the different list views? should I redefine every time the characteristics of the listview for every tab?
Would appreciate an example.
Thanks.
The best way would be to have one listview (your main list view) and then a tabcontrol which will be the host for your tabs (this is called tabbed MDI interface) .
you can create separate forms for each one of your main entities (family,friend,work,etc.) and then based on the clicked item in the main list view you can open (or activate) related tab in the the main tabcontrol .