I have this Activity Planner made up and an part of the assignment when i click on one of the activity’s and click on the add button it goes over to the Selected Activity’s and gets removed form the All activity list and vise versa but dont know how to do this.
Not looking for a full solution( But If you show me one thats fine) but maby a few pointers on how this may be done.
Activity’s what? The apostrophe indicates possession; what is possessed? Or do you mean activities (multiple)? Look at the form. It says “activities” not “activity’s”, so I will assume you mean plural, not possession.
Perhaps the following is what you are trying to say.
When I select one of the activities then click on the “>>” button it is then added to the Selected Activities and is removed from the All Activities list and vise versa.
Since this is a class assignment, it will help you best to help you solve the problem yourself. First, to ask a question, include all relevant information. You do not tell us what type of control the All Activities and Selected Activities are. So do this. Determine what type of control they are then find the relevant Microsoft documentation for the control and post a link to the (class) documentation.
I am not sure what question you are answering but assuming I understand then the answer is ListBox Class. The ListBox.SelectedItems Property is good for determining what item is, or what items are, selected.
Another critical question is how you are accessing the items in the ListBox. This is nearly certainly important since in WPF we nearly always bind the control (the ListBox) to something. Do you know what the ListBox is bound to? Do you understand the question?
Well I will answer that question for you. The LbxExpensives’s ItemsSource property is set to expenses, so the control is bound to expenses, which is an ObservableCollection. So look at the code used to add the items to expenses; do you see that? You can do something like that to add items to the Selected Activities.
First you need to create an ObservableCollection for the Selected Activities if it does not exist. I do not see that in your code. Then you can just add items to it when relevant. Also, look for a method to delete items from ObservableCollections; use that to remove items from the All Activities. I could look it up but it will really help for you to know how to do that. I think that those two methods are the important parts.
What else do you need help with for that assignment?
You have LbxExpensives bound to a collection and that is good but one big problem is that you do not have SelectedActivities bound to a collection. So in other words you have:
ObservableCollection<Expensive> expenses;
And:
LbxExpensives.ItemsSource = expenses;
But you do not have something like that for SelectedActivities. You can and definitely should be consistent.
Since you are using the ObservableCollection class you do not need the BlindNewList method.
In the AddButton_Click method you are accessing the LbxExpensives and SelectedActivities controls directly. You should not do that. You should add and delete items to and from the corresponding collection; expenses for LbxExpensives and whatever collection you create for SelectedActivities.
The preceding are the major issues. It just might work if you solve them. There are other issues but hopefully they are not preventing the program from working at least somewhat.
My guess is that a prior assignment was to do this without using ObservableCollection and now the assignment is to do the same thing with ObservableCollection and you are not sure how to make the conversion. I hope you understand the preceding well enough that you are now able to continue with the assignment.