I have the following projects/assemblies in my solution:
Account
and AccountDetail
. Account
class has a property Details which is of type ObservableCollection<AccountDetail>
and I use it to store the details of the account object. AccountController
whose purpose is to get the data from the Sql Server and to populate the Account
objects (alongside the AccountDetail collection within them). AccountsWindow
whose purpose is to present the list of all accounts retrieved from the Sql ServerAccountWindowController
which is supposed to be the "bridge" between the AccountController
from the Core
assembly and the AccountsWindow
from the Gui
assembly and to assist with the data binding. (I am not sure whether I need this assembly at all.)Here's what I wish to do:
I want to get all accounts from the Sql Server using the AccountController
class from the Core
assembly and to put them in some list. Then, I want to data bind a list box in AccountWindow
with that list of accounts.
My questions:
AccountWindowController
or
somewhere else?ObservableCollection
? Window.Resource
from the Gui.Controller
or
Entities
classes?I know this is a lot of text to read, but my questions are really simple as I am a newbie with the WPF and any help would be greatly appreciated. Thanks!
Update: My agony is continued here. Cheers!
It seems your Gui will be the client and will Reference the other 3 assemblies. Gui.Controller will reference Core and DataEntities, and Core will reference only DataEntities.
The AccountController should fetch the list and return it to the Gui.Controller. It's fine if the list is ObservableCollection. The list itself should be placed in the Gui or Gui.Controller, depending if you can access the properties of Gui.Controller from Gui. When you put the ListBox in a Window which will be placed in the Gui, you need to bind it to a collection. The collection can be a property of the Window. Or you can bind it to a method, which can be part of Gui.Controller. It really depends on how you want to organize it.