ViewMode not Changing

2 posts, 1 answers
  1. Phillip Foster
    Phillip Foster avatar
    58 posts
    Member since:
    Apr 2010

    Posted 25 Feb 2011 Link to this post

    I may be doing something wrong here, but I've added a button to my form that would allow the user to change the view mode. 
    Basically, its just not working. The pageview never changes modes. What am i doing wrong?

    The code is here:


    private void btnView_Click(object sender, EventArgs e)
           {
               if (pvChecklist.ViewMode == PageViewMode.Stack)
                   pvChecklist.ViewMode = PageViewMode.Strip;
               if (pvChecklist.ViewMode == PageViewMode.Strip)
                   pvChecklist.ViewMode = PageViewMode.ExplorerBar;
               if (pvChecklist.ViewMode == PageViewMode.ExplorerBar)
                   pvChecklist.ViewMode = PageViewMode.Stack;
           }
  2. Answer
    Phillip Foster
    Phillip Foster avatar
    58 posts
    Member since:
    Apr 2010

    Posted 25 Feb 2011 Link to this post

    nvm. i fixed it.. I made the following change and it works.

    private void btnView_Click(object sender, EventArgs e)
         {
             PageViewMode pvm = new PageViewMode();
     
             if (pvChecklist.ViewMode == PageViewMode.Stack)
                 pvm = PageViewMode.Strip;
             if (pvChecklist.ViewMode == PageViewMode.Strip)
                 pvm = PageViewMode.ExplorerBar;
             if (pvChecklist.ViewMode == PageViewMode.ExplorerBar)
                 pvm = PageViewMode.Stack;
     
             pvChecklist.ViewMode = pvm;
         }
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top