After a quick view, I see two things:
After calling the ctor of ViewModel, there will be Ivan, Stefan, Maria and Michael in the Persons collection. After calling ViewModel.Add() there will be only Maria and Michael, because you create a new collection.
class Person needs to implement INotifyPropertyChanged and after changing a property it has to call the PropertyChangedEvent.
i am building Kinect Application, obviously using WPF.. Now i have a problem with Navigation. I have a Window and others are Pages that will use a Frame in a Window. So the Window has Button to Main to the "Menu" so the Page that contains Menu's is called "MainMenu.xaml"
now when i navigate to the Menu Page , it shows my Menu page ,but the Window Button is not hidden.
So Before i used to have the code to navigate to the "MainMenu.xaml" in the loaded event of the Window so that it directly moved to the Menu, but my Problem is that still behind even if its behind my Kinect Gesture can click or touch the menu's in the "MainMenu.xaml" it looks like they are not out of scope.
When i move from **MainMenu.xaml** to the selected menu page i do it this way
(Application.Current.MainWindow.FindName("_mainFrame") as Frame).Source = new Uri("/Alphabets101/Menu.xaml", UriKind.Relative);
but still you will see that it tries to Access a "MainMenu" even if they are not visible on the screen
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
This is wat i wanted to do. But as the main thread is very busy it wont show the progress window i know. I used the background worker and showed the progress bar.. But the thing is i have different business logic which will work based on the users clicks.. so i may need to create different workers for handling those.
If i do something like above mentioned window as progress window i can commonly use the same for all places.
Hence request your help here my friends.
thanks in advance.
And you are right i am doing in the back ward only.
But the thing is, I have more the 20 forms in my application which have different functionality. And even in single form i have more than 5 buttons which will do different business logic's. So that is reason i wanted to do this approach, other wise i need to create separate background workers for all buttons or single background worker with different parameters.. which is more messy.
So i planned to have a separate progress window which can be accessed across all the forms.
But as we know both are in same thread causing issue. i planned to open and use the new window in different thread.
Try looking at the BackgroundWorker class. It provides an encapsulation for a worker thread that supports passing updates to the UI taking care of all the dirty cross-thread marshaling. It is very easy to use and supports aborting as well.
As for your progress window, you need to raise it when the first background thread is started and close it when the last background thread ends. You may want to consider creating the form at app startup then setting all of the thread progress notifications to call a notify update method on the form. The form could then determine if it needs to show/hide and which thread(s) progress to show. Again, if you use a backgroundworker, there is a thread complete event which fires when the thread is done making it easy to do something "on the way out the door". The progress window should be event-driven... only responding to events raised by the worker threads.