Click here to Skip to main content
       

Silverlight / WPF

 
QuestionWpf form design Pinmembervikas5515011-Mar-13 20:39 
AnswerRe: Wpf form design PinmvpAbhinav S11-Mar-13 21:29 
Questionerror MC4104? PinmemberSledgeHammer0110-Mar-13 15:08 
QuestionPrism and FluidKit PinmemberDXXL10-Mar-13 2:46 
QuestionWhat is best technology choice (WCF/WPF, WebSockets, Rest) to share webcam video amongst up to 8 users? [modified] PinmemberPaga Cession9-Mar-13 16:57 
QuestionAuto complete text box problem Pinmembercolumbos149277-Mar-13 19:50 
AnswerRe: Auto complete text box problem PinmemberRichard Deeming8-Mar-13 1:25 
QuestionWPF / MVVM - Modular Design Question PinmemberKevin Marois7-Mar-13 7:27 
I am working on this[^] application.
 
The outter set of tabs is on the MainWindowView and the inner tabs are each on their own user control. IN the MainWindowViewMode I have a method called LoadView:
 
private void loadView(View View, _ArgsBase Args = null)
{
    ViewInfo tabInfo = new ViewInfo { View = View, EntityId = 0};
 
    // If the view is already open, then activate its tab
    if (TabManager.IsTabOpen(tabInfo))
    {
        TabManager.ActivateTab(tabInfo);
    }
    else
    {
        // Create an instance of the view and VM
        _DataEntryViewModelBase vm = null;
        UserControl view = null;
        string headerText = string.Empty;
 
        switch (View)
        {
            case View.Dashboard:
                headerText = "Dashboard";
                vm = new DashboardViewModel();
                view = new DashboardView();
                break;
 
            case View.JobCenter:
                headerText = "Job Center";
                vm = new JobCenterViewModel();
                view = new JobCenterView();
                break;
 
            case View.CompanyCenter:
                headerText = "Company Center";
                vm = new CompanyCenterViewModel();
                view = new CompanyCenterView();
                break;
 
            case View.MaterialsCenter:
                headerText = "Materials Center";
                vm = new MaterialsCenterViewModel();
                view = new MaterialsCenterView();
                break;
        }
 
        if (vm == null)
        {
            return;
        }
 
        // Load the vm's data and assign it to the view
        vm.Load(Args);
        view.DataContext = vm;
 
        // Cretae a tab and assign the view to it
        TabItem tabItem = new TabItem();
 
        tabItem.Header = headerText;
        tabItem.Content = view;
        tabItem.Tag = tabInfo;
 
        // Add the tab and activate it
        TabManager.AddTab(tabItem);
    }
}
 
The obvious problem here is that the MainWindowViewModel is now coupled to all the child views. What is the right way to do this?
If it's not broken, fix it until it is

AnswerRe: WPF / MVVM - Modular Design Question PinmemberSledgeHammer017-Mar-13 9:51 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberKevin Marois7-Mar-13 14:10 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberSledgeHammer017-Mar-13 15:07 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberKevin Marois8-Mar-13 5:28 
AnswerRe: WPF / MVVM - Modular Design Question [modified] PinmentorWayne Gaylard8-Mar-13 6:10 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberKevin Marois8-Mar-13 6:14 
GeneralRe: WPF / MVVM - Modular Design Question PinmentorWayne Gaylard8-Mar-13 6:35 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberKevin Marois11-Mar-13 8:39 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberSledgeHammer0111-Mar-13 10:20 
GeneralRe: WPF / MVVM - Modular Design Question PinmentorWayne Gaylard12-Mar-13 1:38 
AnswerRe: WPF / MVVM - Modular Design Question PinmvpAbhinav S10-Mar-13 5:31 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberSledgeHammer0111-Mar-13 14:52 
AnswerRe: WPF / MVVM - Modular Design Question PinmvpAbhinav S11-Mar-13 17:03 
GeneralRe: WPF / MVVM - Modular Design Question PinmemberSledgeHammer0111-Mar-13 17:38 
QuestionHow to expand TreeViewItem programatically? PinmemberSledgeHammer013-Mar-13 19:16 
AnswerRe: How to expand TreeViewItem programatically? PinmemberMycroft Holmes4-Mar-13 11:49 
GeneralRe: How to expand TreeViewItem programatically? PinmemberSledgeHammer014-Mar-13 12:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 16 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid