I want my entire application to have a similar look and feel; as I expect the user does.
Style the most common elements first: TextBoxes; TextBlocks; FontFamily; etc. at the "app" level.
Anchor all your elements in a dummy form / window and see how they look.
The ones that need special handling (negative margins; for example) get styles at the "level" most appropriate: element; parent element; user control; window; dll).
I'm current working on a User Control that does it's own keyboard handling; creates / deletes siblings on the fly; changes color based on "mode"; etc. In this case, I expect a lot of customizing at the control level but still expect to "inherit" colors and fonts from a "higher resource".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
I am trying to make a small "book library" application where readers can rent books.
My application is tructured like this: 4 views(with their associated viewmodels). MainWindow is the main view. Inside it i have a content control where i display the other 3 secondary/child views:HomeView, BookManagingView, ReaderManagingView. The default selected view is HomeView, where i have 2 ListViews(for Readers and Books), and some buttons. In my ReaderManagingView i have some textboxes and buttons to add/update/delete readers from database and listview.
The database has 3 tables: Books, Readers, and RentedBooks.
What i am trying to do is: when i add/update/delete users from my database, i want my changes to reflect (almost)instantly in my ListView.
The problem: The changes are visible only after i restart the application. What should i do, so that my Readers ListView updates after i add/update/delete a user?
Alternatively, as a "quick-and-dirty" approach, you could store the HomeViewModel instance passed to the ReaderManagingViewModel constructor, and call public methods on that instance to add, update and delete readers from the list.
Depending on your requirements, you could either have a single method to reload the entire list:
using (BookDBDataContext rdb = new BookDBDataContext())
ReadersList = new ObservableCollection<Reader>(rdb.Readers);
Or you could have separate methods to add, update and delete the readers:
I have the busiest WPF form I have ever created, 23 combo boxes, 35 text boxes or date pickers and a bunch of buttons and that is just the first tab, there are 10 other tabs with lists and user controls. All user controls are lazy loaded when the tab is selected.
There is a load of automation on the form where 1 action filters/disables 1 or more controls.
I load the data using a BGW thread and that is fast and consistent. The data is loaded into a local object and when the loading is complete I bind the selected object
SelectedObject = LocalObject
The binding is initially resonably fast, sub 1 second, this blows out to 8+ seconds with subsequent page loads. The delay seems to be caused by binding the SelectedObject to the LocalObject (the delay is so huge it can easily be tracked to that line of code).
Any suggestions how I can alleviate the delay problem when binding.
Never underestimate the power of human stupidity
I feel quite defeated and overwhelmed at present. Apologies if this is done incorrectly. Any assistance would be warmly welcomed.
I'm writing a program in WPF, using c#, which should collect inputs via relevant textbox fields. These inputs should filter through to my sql command parameters, where I can then run the stored procedure. Then the info should populate back into a Datagrid in WPF mainwindow.
Basically, searching through historical stock pricing, returning all info between date, price, volume, etc, based on whichever values the user selects.
My SQL stored procedure returns expected values. The only way I can get my program to return the same values is to hardcode each input. I know I am missing the link between getting the values from each textbox into the SQL command parameters, but I'm at a loss as to how to do this. I think I need to set an event in my "mainwindow.xaml.cs" but I just cannot work out the right syntax...