Click here to Skip to main content
15,889,877 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to compare the image in datagridviewImage column Pin
NarVish30-Sep-10 18:56
NarVish30-Sep-10 18:56 
GeneralRe: How to compare the image in datagridviewImage column Pin
Henry Minute30-Sep-10 18:57
Henry Minute30-Sep-10 18:57 
QuestionConsole Apps for Assemblyinfo.cs version number update. Pin
123!@#aruk29-Sep-10 18:57
123!@#aruk29-Sep-10 18:57 
AnswerRe: Console Apps for Assemblyinfo.cs version number update. Pin
SeMartens29-Sep-10 20:51
SeMartens29-Sep-10 20:51 
GeneralRe: Console Apps for Assemblyinfo.cs version number update. Pin
123!@#aruk30-Sep-10 20:39
123!@#aruk30-Sep-10 20:39 
AnswerRe: Console Apps for Assemblyinfo.cs version number update. Pin
Pete O'Hanlon29-Sep-10 21:54
mvePete O'Hanlon29-Sep-10 21:54 
AnswerRe: Console Apps for Assemblyinfo.cs version number update. Pin
PIEBALDconsult30-Sep-10 3:26
mvePIEBALDconsult30-Sep-10 3:26 
QuestionWPF MVVM Navigation Pin
eddieangel29-Sep-10 11:55
eddieangel29-Sep-10 11:55 
I am using a composition of some different code samples to try to work with a WPF (MVVM) application. I started with Josh Smith's multiple view workspace model as below (pertinent snippet)

#region workspaces

      public ObservableCollection<WorkspaceViewModel> Workspaces
      {
          get
          {
              if (_workspaces == null)
              {
                  _workspaces = new ObservableCollection<WorkspaceViewModel>();
                  _workspaces.CollectionChanged += OnWorkspacesChanged;
              }
              return _workspaces;
          }
      }

      private void OnWorkspacesChanged(object sender, NotifyCollectionChangedEventArgs e)
      {
          if (e.NewItems != null && e.NewItems.Count != 0)
              foreach (WorkspaceViewModel workspace in e.NewItems)
                  workspace.RequestClose += OnWorkspaceRequestClose;

          if (e.OldItems != null && e.OldItems.Count != 0)
              foreach (WorkspaceViewModel workspace in e.OldItems)
                  workspace.RequestClose -= OnWorkspaceRequestClose;
      }

      private void OnWorkspaceRequestClose(Object sender, EventArgs e)
      {
          var workspace = sender as WorkspaceViewModel;
          if (workspace != null)
          {
              workspace.Dispose();
              Workspaces.Remove(workspace);
          }
      }

      #endregion

      #region private helpers

      private void DisplayAllFoo()
      {
          var workspace =
              Workspaces.FirstOrDefault(vm => vm is AllFooViewModel)
              as AllFooViewModel;

          if (workspace == null)
          {
              workspace = new AllFooViewModel();
              Workspaces.Add(workspace);
          }

          SetActiveWorkspace(workspace);
      }

      private static void DisplayFoo()
      {
      }

      public void SetActiveWorkspace(WorkspaceViewModel workspace)
      {
          Debug.Assert(Workspaces.Contains(workspace));

          var collectionView = CollectionViewSource.GetDefaultView(Workspaces);
          if (collectionView != null)
              collectionView.MoveCurrentTo(workspace);
      }

      #endregion


So it is easy enough to work with that, XAML code produces a list of commands which point to the voids above. I wanted to use a treeview navigation structure so I could categorize my navigation commands into categories. I used Josh Smith's (PS Thanks Josh Smith!) WPF MVVM Treeview to make a viewmodel for my categories and navigation items and everything is good there. My issue is this, the navigation commands for each navigation item are on the NavigationCommand viewModel, while the workspace and setactive workspace commands are on the mainWindowViewModel. How do I make this work? How can I call the SetActiveWorkSpace command from my NavCommand viewModel?

Sorry for the mess, --EA

P.S. I do lack a lot of fundamental understanding of WPF, just trying to get a foothold in it.
AnswerRe: WPF MVVM Navigation Pin
Arun Jacob29-Sep-10 18:38
Arun Jacob29-Sep-10 18:38 
AnswerRe: WPF MVVM Navigation Pin
Pete O'Hanlon29-Sep-10 21:51
mvePete O'Hanlon29-Sep-10 21:51 
GeneralRe: WPF MVVM Navigation Pin
eddieangel30-Sep-10 6:27
eddieangel30-Sep-10 6:27 
GeneralRe: WPF MVVM Navigation Pin
Pete O'Hanlon30-Sep-10 10:04
mvePete O'Hanlon30-Sep-10 10:04 
Questionreceiving data from usb port Pin
Zafar24829-Sep-10 4:39
Zafar24829-Sep-10 4:39 
AnswerRe: receiving data from usb port Pin
OriginalGriff29-Sep-10 4:51
mveOriginalGriff29-Sep-10 4:51 
GeneralRe: receiving data from usb port Pin
Sauro Viti29-Sep-10 4:56
professionalSauro Viti29-Sep-10 4:56 
GeneralRe: receiving data from usb port Pin
Dave Kreskowiak29-Sep-10 5:48
mveDave Kreskowiak29-Sep-10 5:48 
AnswerRe: receiving data from usb port Pin
Sauro Viti29-Sep-10 4:53
professionalSauro Viti29-Sep-10 4:53 
QuestionWCF Get Endpoint from my Client Pin
softwarejaeger29-Sep-10 3:22
softwarejaeger29-Sep-10 3:22 
AnswerRe: WCF Get Endpoint from my Client Pin
Nish Nishant29-Sep-10 5:34
sitebuilderNish Nishant29-Sep-10 5:34 
GeneralRe: WCF Get Endpoint from my Client Pin
softwarejaeger30-Sep-10 20:45
softwarejaeger30-Sep-10 20:45 
GeneralRe: WCF Get Endpoint from my Client Pin
softwarejaeger4-Oct-10 21:09
softwarejaeger4-Oct-10 21:09 
QuestionWCF Connection Pin
cdpace29-Sep-10 1:03
cdpace29-Sep-10 1:03 
AnswerRe: WCF Connection Pin
Pete O'Hanlon29-Sep-10 1:09
mvePete O'Hanlon29-Sep-10 1:09 
GeneralRe: WCF Connection Pin
cdpace29-Sep-10 1:17
cdpace29-Sep-10 1:17 
GeneralRe: WCF Connection Pin
Pete O'Hanlon29-Sep-10 1:32
mvePete O'Hanlon29-Sep-10 1:32 

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

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